#1

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

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.");
Reply
#3

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];
Reply
#4

Код:
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?
Reply
#5

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");
Reply
#6

i will gonna try it out now
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)