values and vehicle spawns
#3

Quote:
Originally Posted by lackmail
Посмотреть сообщение
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:

Код:
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;
}
this is how you spawn vehicles using timer:
Код:
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
}
but i am sure there is another way to solve this problem just wait for others to give their opinions
thanks for the coca fix! if I want to make it jobwise, I just need to add Job and my pInfo enum?
and check if his job == 1 (lets say smuggler) then only he will be able to smuggle coca?
Reply


Messages In This Thread
values and vehicle spawns - by MrCesar - 20.10.2016, 07:11
Re: values and vehicle spawns - by lackmail - 20.10.2016, 08:05
Re: values and vehicle spawns - by MrCesar - 20.10.2016, 11:13
Re: values and vehicle spawns - by Threshold - 20.10.2016, 12:10
Re: values and vehicle spawns - by JohnBlaze1971 - 20.10.2016, 13:33

Forum Jump:


Users browsing this thread: 2 Guest(s)