SA-MP Forums Archive
Help - 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)
+--- Thread: Help (/showthread.php?tid=381666)



Help - sl!x - 30.09.2012

How to make a cmd usable 1 time and when you die you can use it again is that possible


Re: Help - gtakillerIV - 30.09.2012

Use a variable add this at the top of your script under your includes and defines:

Код:
new can'tuseafterdeath;
Now go to OnPlayerDeath and add this :

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
             can'tuseafterdeath=1;
	return 1;
}
Now go back to your command and add this line:

Код:
if (can'tuseafterdeath==1) return SendClientMessage(playerid, Yellow, "You can't use this command because you've died before.");



Re: Help - gnoomen2 - 30.09.2012

COMMAND:die(playerid, params[])
{
if(pInfo[playerid][pDie] == 0)
{
SetPlayerHealth(playerid, 0);
pInfo[playerid][pDie] = 1;
return 1;
}
if(pInfo[playerid][pDie] == 1)
SendClientMessage(playerid, 0xDEEE20FF, "You have already died one time");
return 1;
}
and somewhere on top of your gm add:

enum
e_PlayerInfo
{
pDie
};
new pInfo[MAX_PLAYERS][e_PlayerInfo];


Re: Help - sl!x - 30.09.2012

Код:
C:\Users\PC\Desktop\new\gamemodes\new.pwn(54) : error 027: invalid character constant
C:\Users\PC\Desktop\new\gamemodes\new.pw(1710) : error 027: invalid character constant
C:\Users\PC\Desktop\new\gamemodes\new.pwn(1710) : warning 215: expression has no effect
C:\Users\PC\Desktop\new\gamemodes\new.pwn(1710) : error 001: expected token: ";", but found "-identifier-"
C:\Users\PC\Desktop\new\gamemodes\new.pwn(1710) : error 017: undefined symbol "useafterdeath"
C:\Users\PC\Desktop\new\gamemodes\new.pwn(1710) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
I get these errors when i add your code

The line 1710 is
Код:
can'tuseafterdeath=1;
and line 54 is
Код:
new can'tuseafterdeath;
What now?


Re: Help - gtakillerIV - 30.09.2012

Stupid me sorry it should be :-

Код:
new cantuseafterdeath;
UnderOnPlayerDeath:-

Код:
cantuseafterdeath=1;
And in your command :-

Код:
if(cantuseafterdeath==1) return SendClientMessage(playerid, Yellow, "You can't use this command because you've died before");



Re: Help - sl!x - 30.09.2012

i will gonna try it out now


Re: Help - sl!x - 30.09.2012

i actualy meant that you can use the command when you login and then you cant use it again only if you die you can use it again.