04.08.2009, 00:48
How can i make this command charge money if it's used...
So it checks if the player has the money, if not it says "Player can not afford the fix" and if he does it takes away 1000 and gives it to the mechanic who fixed his car
Код:
if (strcmp("/fix", cmd, true) == 0) { if (gTeam[playerid] == TEAM_MECHANIC) { new giveplayerid; new giveplayer[MAX_PLAYER_NAME]; new sendername[MAX_PLAYER_NAME]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_ORANGE,"USAGE: /fix [playerid]"); if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR]: The ID you have entered does not exist!"); giveplayerid = ReturnUser(tmp); SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0); GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer)); GetPlayerName(playerid,sendername,sizeof(sendername)); format(tmp,sizeof(tmp),"You fixed %s car!",giveplayer); SendClientMessage(playerid,0x33AA33AA,tmp); format(tmp,sizeof(tmp),"%s has fixed your engine!",sendername); SendClientMessage(giveplayerid,0xAA3333AA,tmp); } else return SendClientMessage(playerid, COLOR_LIME, "Only Mechanics can use that command so stfu and dont do it again!"); return 1; }