Problem with command's compiling / Timer for /acceptdeath
#1

Compiling command issue

As the title says, I get a few errors and warning when trying to compile a ZCMD command. Here is the command and its warning.

Код:
CG-RP1.pwn(26307) : error 029: invalid expression, assumed zero
CG-RP1.pwn(26307) : warning 215: expression has no effect
CG-RP1.pwn(26307) : error 001: expected token: ";", but found "return"
CG-RP1.pwn(26308) : warning 225: unreachable code
Код:
CMD:reviveplayer(playerid, params[])
{
	new id;
	if(PlayerInfo[playerid][pMember] < 1 && PlayerInfo[playerid][pMember] <= 7)) return SendClientMessage(playerid, -1, "You're not a Medic or a LSPD/SASD Officer.");
   	if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "SERVER: /reviveplayer [playerid/PartofName]");
   	Injured[playerid] = 0;
   	SendClientMessage(id, -1, "You were revived.");
   	SendClientMessage(playerid, -1, "You revived that player.");
   	ApplyAnimation(id,"PED","null",0.0,0,0,0,0,0); // would make them stand up i guess
   	return 1;
}
Anyone who fixes this the fastest and the most efficiently will get a +rep. Also, the code for the return part may look fucked but in reality thats how it is in Pawno. I'll give you a snippet of it.
NOTE: I'm not scripting professional, you could call me a novice or a advanced newbie.


(Yes, I do use Notepad++ with the PAWN API.)

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ACCEPT DEATH TIMER

I just need a timer for my accept death command. Here it is.
WARNING: Its very simple, no errors with this either.

Код:
CMD:acceptdeath(playerid, params[])
{
    SendClientMessage(playerid, -1, "NOTE: 160 seconds hasn't passed to allow you to accept death!");
    //Whatever bullshit has to come here
    SendClientMessage(playerid, -1, "NOTE: You have accepted death!");
    SetPlayerHealth(playerid, 0.0);
    SetPlayerArmour(playerid, 0.0);
    Injured[playerid] = 0;
    return 1;
}
As the SendClientMessage says, you need to wait 160minutes before it allows you to accept death. This will activate once Injured[playerid] = 1; is activated, which sets its value to 1; once you reach 10hp.
Reply
#2

Код:
CMD:reviveplayer(playerid, params[])
{
	new id;
	if(PlayerInfo[playerid][pMember] < 1 && PlayerInfo[playerid][pMember] <= 7) return SendClientMessage(playerid, -1, "You're not a Medic or a LSPD/SASD Officer.");
   	if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "SERVER: /reviveplayer [playerid/PartofName]");
   	Injured[playerid] = 0;
   	SendClientMessage(id, -1, "You were revived.");
   	SendClientMessage(playerid, -1, "You revived that player.");
   	ApplyAnimation(id,"PED","null",0.0,0,0,0,0,0); // would make them stand up i guess
   	return 1;
}
You had )) on that condition.
Reply
#3

extra parentheses
Код:
if(PlayerInfo[playerid][pMember] < 1 && PlayerInfo[playerid][pMember] <= 7))
Reply
#4

Although CaRaM3LL replied first, both of you (@Sreyas and @CaRaM3LL) will recieve a +rep! Thanks!
Reply
#5

I feel this like a contest.

For the other problem i suggest you to use: https://sampwiki.blast.hk/wiki/SetTimerEx.
Reply
#6

Quote:
Originally Posted by CaRaM3LL
Посмотреть сообщение
I feel this like a contest.

For the other problem i suggest you to use: https://sampwiki.blast.hk/wiki/SetTimerEx.
It isnt, I just need help desperately. I've never fiddled about with Timer's and so thats why I dont want to try it until I see a CLEAR example of it made by A PERSON outputted onto a code box, not placed in a public wiki.
Reply
#7

Quote:
Originally Posted by xLucy
Посмотреть сообщение
It isnt, I just need help desperately. I've never fiddled about with Timer's and so thats why I dont want to try it until I see a CLEAR example of it made by A PERSON outputted onto a code box, not placed in a public wiki.
I don't get it. You have all the info on wiki page about that function. You can do whatever you want.

I think this is not what you want to do but here an exemple:

Код:
CMD:acceptdeath(playerid, params[])
{
    SetTimerEx("AcceptDeath", 160000, false, "i",playerid); // 160000, 160 seconds in ms
    return 1;
}

stock AcceptDeath(playerid)
{
	SendClientMessage(playerid, -1, "NOTE: You have accepted death!");
        SetPlayerHealth(playerid, 0.0);
        SetPlayerArmour(playerid, 0.0);
        Injured[playerid] = 0;
	return 1;
}
stock AcceptDeath will be appeal when the timer reaches to 0 ms.
Reply
#8

Alright, great, but, here's another LAST thing I need, and thats it.

Would this work, to detect whether you've been revived or not, before the stock gets applied?

Код:
If(injured[playerid] = 1) return SendClientMessage(playerid, -1, "SERVER: You were revived quicker than the acceptdeath timer ended!");
Doesnt seem to work for me.
Reply
#9

Yes, but

Код:
 If(injured[playerid] = 1)
is not correct

Код:
 If(injured[playerid] == 1)
this is.

You need first of all to "turn on" that variabile somewhere, i think onplayerdeath is okay.

You set like this

Код:
 injured[playerid] = 1;
and then you check if he is injured or not.
Reply
#10

Change "Injured[playerid] = 0;" in /reviveplayer to "Injured[id] = 0;" FYI or it's going to set it for the player sending the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)