Whats wrong with this? - 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: Whats wrong with this? (
/showthread.php?tid=277025)
Whats wrong with this? -
Shockey HD - 16.08.2011
pawn Код:
CMD:surrender(playerid,params[])
{
if(PlayerInfo[playerid][pTeam] ==0)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
PlayerInfo[playerid][pSurrender] = 1;
}
else if(PlayerInfo[playerid][pSurrender] ==1)
{
ClearAnimations(playerid);
PlayerInfo[playerid][pSurrender] = 0;
}
return 1;
}
It just dosnt work. I dont get a Unkown Command, am i just not activating Hands up?
Respuesta: Whats wrong with this? -
Alex_Obando - 16.08.2011
This does not support on Sscanf.
Try using strmp.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/surrender", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][pTeam] ==0)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
PlayerInfo[playerid][pSurrender] = 1;
}
else (PlayerInfo[playerid][pSurrender] ==1)
}
ClearAnimations(playerid);
PlayerInfo[playerid][pSurrender] = 0;
}
return 1;
}
return 0;
}
Re: Whats wrong with this? -
Scenario - 16.08.2011
Quote:
Originally Posted by Shockey HD
pawn Код:
CMD:surrender(playerid,params[]) { if(PlayerInfo[playerid][pTeam] ==0) { SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP); PlayerInfo[playerid][pSurrender] = 1; } else if(PlayerInfo[playerid][pSurrender] ==1) { ClearAnimations(playerid); PlayerInfo[playerid][pSurrender] = 0; } return 1; }
It just dosnt work. I dont get a Unkown Command, am i just not activating Hands up?
|
Did you remove the "OnPlayerCommandText" callback from your script?
Re: Respuesta: Whats wrong with this? -
Shockey HD - 16.08.2011
Quote:
Originally Posted by Alex_Obando
This does not support on Sscanf.
Try using strmp.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/surrender", cmdtext, true, 10) == 0) { if(PlayerInfo[playerid][pTeam] ==0) { SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP); PlayerInfo[playerid][pSurrender] = 1; } else (PlayerInfo[playerid][pSurrender] ==1) } ClearAnimations(playerid); PlayerInfo[playerid][pSurrender] = 0; } return 1; } return 0; }
|
Why would i use strcmp?
Strcmp= Slow
Yes, OnPlayerCommandText is removed. I changed it so the code looks like this.
pawn Код:
CMD:surrender(playerid,params[])
{
if(PlayerInfo[playerid][pSurrender] ==0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
ApplyAnimation(playerid,"ROB_BANK","SHP_HandsUp_Scr",4.1,1,1,1,1,1,1);
TogglePlayerControllable(playerid,0);
PlayerInfo[playerid][pSurrender] = 1;
}
}
else if(PlayerInfo[playerid][pSurrender] ==1)
{
ClearAnimations(playerid);
PlayerInfo[playerid][pSurrender] = 0;
TogglePlayerControllable(playerid,1);
}
return 1;
}
But it still dosnt work
Re: Respuesta: Whats wrong with this? -
Scenario - 16.08.2011
Quote:
Originally Posted by Shockey HD
Why would i use strcmp?
Strcmp= Slow
Yes, OnPlayerCommandText is removed. I changed it so the code looks like this.
pawn Код:
CMD:surrender(playerid,params[]) { if(PlayerInfo[playerid][pSurrender] ==0) { if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { ApplyAnimation(playerid,"ROB_BANK","SHP_HandsUp_Scr",4.1,1,1,1,1,1,1); TogglePlayerControllable(playerid,0); PlayerInfo[playerid][pSurrender] = 1; } } else if(PlayerInfo[playerid][pSurrender] ==1) { ClearAnimations(playerid); PlayerInfo[playerid][pSurrender] = 0; TogglePlayerControllable(playerid,1); } return 1; }
But it still dosnt work
|
Okay, add the "OnPlayerCommandText" callback back into your script. I had this problem too, where commands quit working unless that callback was there. You can just do this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) return 0;
Re: Whats wrong with this? -
Mark1984 - 16.08.2011
It should work what RealCop228 said