case [help]
#1

how do i make this script so when the player dies he dont gain money


Код:
//Top of scrip
new Pickup;
new PlayerMoney;
new PlayerMoneyPickup;
forward Timer(playerid);
new PlayerHasCase[MAX_PLAYERS];

public OnGameModeInit()
{
Pickup = CreatePickup(1210, 2, 2019.7742,1344.4839,10.8203);
Return 1;
}

new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PlayerMoney = GetPlayerMoney(playerid);
PlayerMoneyPickup = CreatePickup(1210, 2, 2019.7742,1344.4839,10.8203);

if(!strcmp(cmdtext, "/opencase", true))
{
	if (PlayerHasCase[playerid] == 1)
	{
 	new rand = random(3);
	  switch(rand)
	  {
	    case 0:
	    {
	      SetPlayerHealth(playerid,0);
	      SendClientMessage(playerid,0xFFFF00AA, "You Tripped The Explosive");
	      PlayerHasCase[playerid] = 0;
			}
	    case 1:
	    {
	      GivePlayerWeapon(playerid, 35, 15);
	      SendClientMessage(playerid,0xFFFF00AA, "You Got 15 Well packed rockets");
	      PlayerHasCase[playerid] = 0;
		 }
	    case 2:
	    {
	      GivePlayerMoney(playerid,43631);
	      SendClientMessage(playerid,0xFFFF00AA, "It is Your LUCKY day");
	      PlayerHasCase[playerid] = 0;
			}
	  }
	}
  return 1;
 }

public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == Pickup)
	{
		GivePlayerMoney(playerid, 1000);
		SendClientMessage(playerid, 0x33AA33AA, "You Better Run They Gonna Whant That Money");
		SetTimerEx("Timer", 40000, 0, "i", playerid);
		DestroyPickup(Pickup);
		PlayerHasCase[playerid] = 1;
	}

	if(pickupid == PlayerMoneyPickup)
	{
		GivePlayerMoney(playerid, PlayerMoney);
		DestroyPickup(PlayerMoneyPickup);
		PlayerHasCase[playerid] = 1;
	}
	return 1;
}

public Timer(playerid)
{
	GivePlayerMoney(playerid, 1000);
	SetTimerEx("Timer", 40000, 0, "i", playerid);
	return 1;
}
Reply
#2

need help
Reply
#3

Don't bump...

Add a:

pawn Код:
new woot;
At the top of your script, and then replace all your

pawn Код:
SetTimerEx("Timer", 40000, 0, "i", playerid);
With this:

pawn Код:
woot = SetTimerEx("Timer", 40000, 0, "i", playerid);
And then add this under OnGameModeInit:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  KillTimer(woot);
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)