Small command error.
#1

Ok so I made this command, that allows to player to accept his death after dying but seems like it doesn't work.
here is the command : how can I solve it ?
PHP код:
new pdeath[MAX_PLAYERS]; 
PHP код:
public OnPlayerSpawn(playerid)
{
 
SetPlayerColor(playerid0xFFFFFFAA);
SetPlayerMoney(playerid5000);
if(
pdeath == 1)
{
TogglePlayerControllable(playerid0);
SetPlayerPos(playerid,1583.4307,-1634.7228,13.3905);
SendClientMessage(playerid0xFF4646FF"/acceptdeath"); 
}
TogglePlayerControllable(playerid1);
  return 
1;

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
pdeath[playerid] = 1;
return 
1;

PHP код:
 if (strcmp(cmdtext"/acceptdeath"true) == 0)
    {
 if(
pdeath == 0) return SendClientMessage(playerid0xFF4646FF"blablabla");
GivePlayerMoney(playerid, -500);
pdeath 0;
    return 
1;

PHP код:
warnings :
C:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\gamemodes\RP.pwn(294) : error 033: array must be indexed (variable "pdeath")
C:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\gamemodes\RP.pwn(528) : error 033: array must be indexed (variable "pdeath")
C:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\gamemodes\RP.pwn(530) : error 033: array must be indexed (variable "pdeath")
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
3 Errors

Reply
#2

Haven't bothered reading the rest of your code but I noticed your array and this:
pawn Код:
if (strcmp(cmdtext, "/acceptdeath", true) == 0)
    {

 if(pdeath == 0) return SendClientMessage(playerid, 0xFF4646FF, "blablabla");
GivePlayerMoney(playerid, -500);
pdeath = 0;

    return 1;
}
Change

pawn Код:
pdeath = 0;
to

pawn Код:
pdeath[playerid] = 0;
Reply
#3

PHP код:
error 033: array must be indexed (variable "pdeath")
C:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\gamemodes\RP.pwn(528) : error 033: array must be indexed (variable "pdeath"
one is in the oncommandtext and the second is on playerdeath
Reply
#4

Change every pdeath you have to pdeath[playerid].
Reply
#5

It worked, can any one tell me help with making an animation command, only when they die the character will go on "flip animation "
Reply
#6

It worked, can any one tell me help with making an animation command, only when they die the character will go on "flip animation "
Reply
#7

Try This:
Quote:

if (strcmp(cmdtext, "/acceptdeath", true) == 0)
{
if(pdeath[playerid] == 0) return SendClientMessage(playerid, 0xFF4646FF, "blablabla");
GivePlayerMoney(playerid, -500);
pdeath[playerid] = 0;
return 1;
}

Reply
#8

Doesn't work, here check my code :
When the player dies it freezes him and when he does the command it releases him, and afterwards the death animation is plaid, can anyone help me fix so that when the player dies it will go on
"flip animation" and freeze him, and when he uses the command it will thaw him and spawn him at a certain point.
Here is my command :
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
TogglePlayerControllable(playerid0);
pdeath[playerid] = 1;
SendClientMessage(playerid0xFF4646FF"bbbbbdfgdfgdfg !");
SetPlayerPos(playerid,1583.4307,-1634.7228,13.3905);
return 
1;

PHP код:
 if (strcmp(cmdtext"/acceptdeath"true) == 0)
    {
 if(
pdeath[playerid] == 0) return SendClientMessage(playerid0xFF4646FF"You are not dead.");
GivePlayerMoney(playerid, -500);
pdeath[playerid] = 0;
TogglePlayerControllable(playerid1);
    return 
1;

Reply
#9

At OnPlayerDeath (The animations are good, but I dunno if it will work on OnPlayerDeath, but okay..) :

pawn Код:
ApplyAnimation(playerid,"PED","BIKE_fallR",4.0,0,1,1,1,0); //Rolling over animation
At /acceptdeath:

pawn Код:
ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0); // Going back to normal position in a smooth way.
Reply
#10

Awesome, it works, thanks a lot. !
But, when he dies it spawns him back while doing the animation, how can I make him do the animation, while staying exactly where he died ? and then after using the command moving him to a certain point ! ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)