12.06.2014, 12:11
Hello, I would like to adapt my gamemode garages system and let me know my mistake.
Please, help me.
ERROR:
COMMAND:
Please, help me.
ERROR:
Код:
format(GarageInfo[idx][gOwner], 32, "%s", RPNU(playerid));
Код:
CMD:buygarage(playerid, params[])
{
new string[128], done, RPNU;
if(Info[playerid][pAdmin] != 6) return SendClientMessage(playerid, -1, "You are not Admin Man!");
if(Info[playerid][pGarage]) return SendClientMessage(playerid, COLOR_GREY, "You already own a garage.");
for(new idx=1; idx<MAX_GARAGES; idx++)
{
if(IsPlayerInRangeOfPoint(playerid, 3, GarageInfo[idx][gX], GarageInfo[idx][gY], GarageInfo[idx][gZ]))
{
if(!strcmp("The State", GarageInfo[idx][gOwner], false))
{
if(Info[playerid][pCash] < GarageInfo[idx][gPrice]) return SendClientMessage(playerid, COLOR_WHITE, "You don't have enough money to buy this garage.");
GivePlayerCash(playerid, -GarageInfo[idx][gPrice]);
if(Info[playerid][pGarage]) Info[playerid][pGarage] = idx;
else Info[playerid][pGarage] = idx;
format(GarageInfo[idx][gOwner], 32, "%s", RPNU(playerid));
format(string, sizeof(string), COLOR_WHITE, "%d,\n Garage (Lvl: %d)\nOwner %s", idx, GarageInfo[idx][gLevel], GarageInfo[idx][gOwner]);
UpdateDynamic3DTextLabelText(GarageInfo[idx][gText], COLOR_WHITE, string);
SendClientMessage(playerid, COLOR_WHITE, " You have successfully bought a garage.");
format(string, sizeof(string), "%s has bought garage id %d.", RPN(playerid), idx);
Log("logs/garage.log", string);
//Log("logs/garage.log", string);
idx = MAX_GARAGES;
done = 1;
}
if(idx == MAX_GARAGES-1 && !done)
{
SendClientMessage(playerid, COLOR_GREY, "This garage is owned by someone else.");
}
}
if(idx == MAX_GARAGES-1 && !done)
{
SendClientMessage(playerid, COLOR_GREY, "You are not near a buyable garage.");
}
}
return 1;
}

