SA-MP Forums Archive
help with a few things - 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: help with a few things (/showthread.php?tid=67158)



help with a few things - CJ101 - 27.02.2009

In OnPlayerDeath, how can i check if the reason for death is by /kill? is there like an id for that?

also, i have a /rob command for the casino. how would i make random money to be given, and display it:

format(string, sizeof(string), "%s has robbed caligulas casino and got a total of [amnt. of money]",pName);

Код:
 if(strcmp(cmdtext, "/rob", true) == 0)
	{
	if(GetPlayerInterior(playerid) == 1)
	{
	SendClientMessage(playerid, COLOR_GREEN, "== You robbed the casino and got $10,000");
	SendClientMessage(playerid, COLOR_YELLOW, "== Get to the safe zone to clear wanted level.");
  new pName[MAX_PLAYER_NAME];
  new string [265];
	GetPlayerName(playerid,pName,sizeof(pName));
  format(string, sizeof(string), "%s has robbed caligulas casino and got a total of $10,000",pName);
  SendClientMessageToAll(COLOR_RED,string);
	GivePlayerMoney(playerid,10000);
	SetPlayerWantedLevel(playerid,6);
	}
	else
	{
	SendClientMessage(playerid, COLOR_RED, "== You must be in Caligulas Casino to rob.");
	}



Re: help with a few things - Jefff - 27.02.2009

In OnPlayerDeath, how can i check if the reason for death is by /kill? is there like an id for that?

Yes 255.


also, i have a /rob command for the casino. how would i make random money to be given, and display it:

format(string, sizeof(string), "%s has robbed caligulas casino and got a total of [amnt. of money]",pName);

Код:
//top
new CasinoCash[6] = {100,300,3000,4534,47,456};
and this
Код:
new rand = random(sizeof(CasinoCash));
format(string, sizeof(string), "%s has robbed caligulas casino and got a total of %d $",pName,rand);
GivePlayerMoney(playerid,rand);