20.10.2016, 08:05
you was sending the message of "you just used..." and PlayerInfo[playerid][Cocaine] -= 2; before checking the health thats why no matter whats your health is you will get the message and minus 2 cocaine as long you have 2 or more cocaine
use this:
this is how you spawn vehicles using timer:
but i am sure there is another way to solve this problem just wait for others to give their opinions
use this:
Код:
CMD:usecoca(playerid, params[]) { if(PlayerInfo[playerid][Cocaine] >=2) { new Float:health; GetPlayerHealth(playerid,health); if (health < 100) { SetPlayerHealth(playerid, health +15); PlayerInfo[playerid][Cocaine] -= 2; SendClientMessage(playerid, -1, "you just used 2 grams of cocaine restored 20 hp"); } else if(health == 100) { SendClientMessage(playerid, -1, "why use coca"); } } else SendClientMessage(playerid, -1, "you dont have enough coca"); return 1; }
Код:
public OnGameModeInit() { SetTimer("SpawnVehicle", 10000, false); // spawns vehicle after 10 seconds you can use this line in a command } forward SpawnVehicle(); public SpawnVehicle() { CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, -1, -1, 60); /// add your vehicles here }