Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Property commands won't work

$
0
0
So i have these two commands with which i can lock my property and unlock it.They seem alright to me but still when i do lockprop it just doesnt lock it.Help me out please.

Code:

CMD:lockprop(playerid, params[])
{
        new playername[25], giveplayer[25], tmp2[256], temp2;
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        if (areatype[playerarea[playerid]][0] != AREA_TYPE_PROP) return SendClientMessage2(playerid, COLOR_RED, "You must be at your property to lock it!");
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        if (areatype[playerarea[playerid]][1] != dini_Int(AddDirFile(dir_userfiles, playername), "propowned")) return SendClientMessage2(playerid, COLOR_RED, "You do not own this property!");
        format(giveplayer, 10, "PROP%d", areatype[playerarea[playerid]][1]);
        if(!dini_Isset(AddDirFile(dir_propfiles, giveplayer), "interior")) return SendClientMessage(playerid, COLOR_RED,"Your Prop Doesnt Have An Interior.");
        temp2 = dini_Int(AddDirFile(dir_propfiles, giveplayer), "interior");
        format(tmp2, sizeof(tmp2), "propint%d", temp2);
        //if(dini_Int(AddDirFile(dir_propints, tmp2), "Locked")==1) return SendClientMessage(playerid, COLOR_RED, "Error:{FFFFFF}You Have Already Locked Your Prop.");
        if(dini_Isset(AddDirFile(dir_propints, tmp2), "Locked")) return SendClientMessage2(playerid, COLOR_RED, "You Have Already Locked Your Prop.");
        dini_IntSet(AddDirFile(dir_propints, tmp2), "Locked", 1);
        GameTextForPlayer(playerid, "~p~Property Locked", 5000, 3);
        return 1;
}
CMD:unlockprop(playerid, params[])
{
        new playername[25], giveplayer[25], tmp2[256], temp2;
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        if (areatype[playerarea[playerid]][0] != AREA_TYPE_PROP) return SendClientMessage2(playerid, COLOR_RED, "You must be at your property to lock it!");
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        if (areatype[playerarea[playerid]][1] != dini_Int(AddDirFile(dir_userfiles, playername), "propowned")) return SendClientMessage2(playerid, COLOR_RED, "You do not own this property!");
        format(giveplayer, 10, "PROP%d", areatype[playerarea[playerid]][1]);
        if(!dini_Isset(AddDirFile(dir_propfiles, giveplayer), "interior")) return SendClientMessage(playerid, COLOR_RED,"Your Prop Doesnt Have An Interior.");
        temp2 = dini_Int(AddDirFile(dir_propfiles, giveplayer), "interior");
        format(tmp2, sizeof(tmp2), "propint%d", temp2);
        //if(dini_Int(AddDirFile(dir_propints, tmp2), "Locked")==0) return SendClientMessage(playerid, COLOR_RED, "Error:{FFFFFF}You Have Already UnLocked Your Prop.");
        //dini_IntSet(AddDirFile(dir_propints, tmp2), "Locked", 0);
        if(!dini_Isset(AddDirFile(dir_propints, tmp2), "Locked")) return SendClientMessage2(playerid, COLOR_RED, "You Have Already UnLocked Your Prop.");
        dini_Unset(AddDirFile(dir_propints, tmp2), "Locked");
        GameTextForPlayer(playerid, "~p~Property unLocked", 5000, 3);
        return 1;
}


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>