10.12.2010, 20:30
Pretty weird problem. For the other commands I use exactly the same method, but somehow it doesn't work for this one.
The command only works for a pickup(business) with the ID: 1.
Here's the code.
If you're trying this command at a business with the ID 2 or higher, it will say I didn't enter the 'tmp'.
It will give this message: USAGE: /setentfee <entry fee>
The command only works for a pickup(business) with the ID: 1.
Here's the code.
pawn Код:
if(strcmp(cmd, "/setentfee", true) == 0)
{
new playernamez[MAX_PLAYER_NAME];
GetPlayerName(playerid, playernamez, sizeof(playernamez));
new file[31];
for(new i; i < sizeof(BusinessData); i++)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /setentfee <entry fee>");
return 1;
}
format(file, sizeof(file), "BusinessData/%i.txt", i + 1);
if(IsPlayerInRangeOfPoint(playerid, 2, x, y, z)) // x y z is already defined.
{
new entryfee;
entryfee = strval(tmp);
if(entryfee < 0 || entryfee > 5000) { return SendClientMessage(playerid, COLOR_RED, "Entry fee cannot be lower than $0 or higher than $5000"); }
if(!strcmp(playernamez, BusinessData[i][BusinessOwner], false))
{
BusinessData[i][EntFee] = entryfee;
dini_IntSet(file, "EntFee", entryfee);
format(string, sizeof(string), "You've set your entry fee to: $%i", entryfee);
SendClientMessage(playerid, NEWBIE_COLOR, string);
break;
}
}
}
}
It will give this message: USAGE: /setentfee <entry fee>