21.06.2009, 22:40
I got a problem with my command. I want when someone type /getmats he will receive 10 packages for 500$, once he goes at the checkpoints he will receive 250 Materials and the checkpoint disapear until the next run.
This is my script : (GodFather)
Thanks for your help.
This is my script : (GodFather)
Код:
if(strcmp(cmd,"/getmats",true)==0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pJob] == 8) { SendClientMessage(playerid,COLOR_GREY," You are not a Arms Dealer !"); return 1; } if(MatsHolding[playerid] >= 10) { SendClientMessage(playerid, COLOR_GREY, " You can't hold any more Materials Packages !"); return 1; } if(PlayerToPoint(3.0,playerid,1424.0065,-1319.2479,13.5547)) { cmd = strtok(cmdtext, idx); if(!strlen(cmd)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /getmats [ammount]"); moneys = strval(tmp); if(moneys < 1 || moneys > 10) { SendClientMessage(playerid, COLOR_GREY, " Package Number can't be below 1 or higher then 10 !"); return 1; } new price = moneys * 50; if(GetPlayerMoney(playerid) > price) { format(string, sizeof(string), "* You bought %d Materials Packages for $%d.", moneys, price); SetPlayerCheckpoint(playerid,2172.6719,-2264.1987,13.3424,3.0); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); GivePlayerMoney(playerid, - price); MatsHolding[playerid] = moneys; } else { format(string, sizeof(string), " You can't afford the $%d !", price); SendClientMessage(playerid, COLOR_GREY, string); } if(IsPlayerInCheckpoint(playerid, 2172.6719,-2264.1987,13.3424)) { SendClientMessage(playerid, COLOR_GREY, " You are not at The Factory !"); return 1; } if(MatsHolding[playerid] > 0) { SendClientMessage(playerid, COLOR_GREY, " You don't have any Materials Packages !"); return 1; } new payout = (50)*(MatsHolding[playerid]); format(string, sizeof(string), "* The Factory gave you %d Materials for your %d Materials Packages.", payout, MatsHolding[playerid]); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); PlayerInfo[playerid][pMats] += payout; DisablePlayerCheckpoint(playerid); MatsHolding[playerid] = 0; return 1; }