SA-MP Forums Archive
SOLVED - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SOLVED (/showthread.php?tid=156240)



SOLVED - Jay. - 21.06.2010

hi, I have a little problem with my script..


I was making random death messages for my server..

So i wasn't realy sure what to do.


So i done this

Код:
public OnPlayerDeath(playerid, killerid, reason)
{  switch(reason)
	{
	  case 0: GameTextForPlayer(playerid,"~W~lol You got owned!",4000,1);
	  case 1: GameTextForPlayer(playerid,"~R~hahah you died!!!",4000,0);
	  case 2: GameTextForPlayer(playerid,"~w~ WASTED!",4000,2);
	}
	return 1;
}
But it didn't work

Anyone no whats wrong?


Xtreme


Re: problem with my script - Hiddos - 21.06.2010

the 'reason' is usually the weapon you got killed with.

https://sampwiki.blast.hk/wiki/OnPlayerDeath


Re: problem with my script - Jay. - 21.06.2010

Quote:
Originally Posted by Hiddos
the 'reason' is usually the weapon you got killed with.

https://sampwiki.blast.hk/wiki/OnPlayerDeath

EDIT:

Sorry that wasn't very clear.

What i was trying to make is random

messages for when the player dies.

Did you see my code?


Re: problem with my script - Hiddos - 21.06.2010

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{  switch(random(3))
    {
      case 0: GameTextForPlayer(playerid,"~W~lol You got owned!",4000,1);
      case 1: GameTextForPlayer(playerid,"~R~hahah you died!!!",4000,0);
      case 2: GameTextForPlayer(playerid,"~w~ WASTED!",4000,2);
    }
    return 1;
}
If it doesn't works:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{  
    new rand = random(3);
    switch(rand)
    {
      case 0: GameTextForPlayer(playerid,"~W~lol You got owned!",4000,1);
      case 1: GameTextForPlayer(playerid,"~R~hahah you died!!!",4000,0);
      case 2: GameTextForPlayer(playerid,"~w~ WASTED!",4000,2);
    }
    return 1;
}
If it still doesn't worK:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{  
    new rand = random(3);
     if(rand == 0) GameTextForPlayer(playerid,"~W~lol You got owned!",4000,1);
     if(rand == 1) GameTextForPlayer(playerid,"~R~hahah you died!!!",4000,0);
     if(rand == 2) GameTextForPlayer(playerid,"~w~ WASTED!",4000,2);
    return 1;
}



Re: problem with my script - Jay. - 21.06.2010

Quote:
Originally Posted by Hiddos
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{  switch(random(3))
    {
      case 0: GameTextForPlayer(playerid,"~W~lol You got owned!",4000,1);
      case 1: GameTextForPlayer(playerid,"~R~hahah you died!!!",4000,0);
      case 2: GameTextForPlayer(playerid,"~w~ WASTED!",4000,2);
    }
    return 1;
}
If it doesn't works:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{  
    new rand = random(3);
    switch(rand)
    {
      case 0: GameTextForPlayer(playerid,"~W~lol You got owned!",4000,1);
      case 1: GameTextForPlayer(playerid,"~R~hahah you died!!!",4000,0);
      case 2: GameTextForPlayer(playerid,"~w~ WASTED!",4000,2);
    }
    return 1;
}
If it still doesn't worK:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{  
    new rand = random(3);
     if(rand == 0) GameTextForPlayer(playerid,"~W~lol You got owned!",4000,1);
     if(rand == 1) GameTextForPlayer(playerid,"~R~hahah you died!!!",4000,0);
     if(rand == 2) GameTextForPlayer(playerid,"~w~ WASTED!",4000,2);
    return 1;
}
Thanks, I'll test them.

And are tell you if they worked or not.


SOLVED - Jay. - 21.06.2010

Second one worked.

Thanks..




Re: problem with my script - Hiddos - 21.06.2010

Enjoy it

Feel free to ask for more help. Just do me a favor and don't PM me ^^


Re: problem with my script - Jay. - 22.06.2010

Quote:
Originally Posted by Hiddos
Enjoy it

Feel free to ask for more help. Just do me a favor and don't PM me ^^
Lol, I know how Begging scripting request PMs feel. ^^