SA-MP Forums Archive
Small command error. - 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: Small command error. (/showthread.php?tid=179940)



Small command error. - Scriptissue - 29.09.2010

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




Re: Small command error. - Calgon - 29.09.2010

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;



Re: Small command error. - Scriptissue - 29.09.2010

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


Re: Small command error. - [XST]O_x - 29.09.2010

Change every pdeath you have to pdeath[playerid].


Re: Small command error. - Scriptissue - 29.09.2010

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


Re: Small command error. - Scriptissue - 29.09.2010

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


Re: Small command error. - HyperZ - 29.09.2010

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;
}




Re: Small command error. - Scriptissue - 29.09.2010

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;




Re: Small command error. - rbN. - 29.09.2010

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.



Re: Small command error. - Scriptissue - 29.09.2010

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 ! ?