public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid) //Works
{
if(Enforcer[playerid] == 1)
{
if(GetPlayerWeapon(playerid) == 33)
{
StunPlayer(damagedid);
SetTimer("StunTime",7000,false);
}
return 1;
}
return 0;
}
public StunTime() //Works
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(Stuned[i] == 1)
{
TogglePlayerControllable(i,1);
Stuned[i] = 0;
ClearAnimations(i);
return 1;
}
}
return 1;
}
COMMAND:arrest(playerid, params[]) //Dont works
{
new stunedid;
if (Enforcer[playerid] == 1)
{
if (!sscanf(params, "u", stunedid))
{
if (Stuned[stunedid] == 1) //This is the problem
{
SetPlayerScore(stunedid,GetPlayerScore(stunedid)-10);
GivePlayerMoney(stunedid,-10000);
new rand = random(sizeof(RandomCrimSpawns));
SetPlayerPos(stunedid, RandomCrimSpawns[rand][0], RandomCrimSpawns[rand][1], RandomCrimSpawns[rand][2]);
SetPlayerFacingAngle(stunedid, RandomCrimSpawns[rand][3]);
SetCameraBehindPlayer(stunedid);
SendClientMessage(stunedid,GCOLOR_GREY,"* You have been arrested! You lost 10000$ and 10 Score");
SetPlayerScore(playerid,GetPlayerScore(playerid)+10);
GivePlayerMoney(playerid,10000);
SendClientMessage(stunedid,GCOLOR_GREY,"* You arrested Criminal and received 10000$ and 10 Score");
}
else SendClientMessage(playerid, GCOLOR_RED, "ERROR: That player is not stunned!");
}
else SendClientMessage(playerid, GCOLOR_RED, "Usage: /arrest <stuned-playerid>");
}
else SendClientMessage(playerid, GCOLOR_RED, "ERROR: Only Enforcers can use this command!");
return 1;
}
stock StunPlayer(playerid)
{
TogglePlayerControllable(playerid,0);
GameTextForPlayer(playerid,"~r~STUNNED!",7000,3);
Stuned[playerid] = 1;
ApplyAnimation(playerid, "ped", "cower", 3.0, 1, 0, 0, 0, 0);
return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid) //Works
{
if(Enforcer[playerid] == 1)
{
if(GetPlayerWeapon(playerid) == 33)
{
StunPlayer(damagedid);
SetTimerEx("StunTime",7000,false,"d",damagedid);
}
return 1;
}
return 0;
}
public StunTime(damagedid) //Works
{
if(Stuned[damagedid] == 1)
{
TogglePlayerControllable(damagedid,1);
Stuned[damagedid] = 0;
ClearAnimations(damagedid);
return 1;
}
return 1;
}
COMMAND:arrest(playerid, params[]) //Dont works
{
new stunedid;
if (Enforcer[playerid] == 1)
{
if (strlen(params)>0)
{
stuneid = strval(params);
if (Stuned[stunedid] == 1) //This is the problem
{
SetPlayerScore(stunedid,GetPlayerScore(stunedid)-10);
GivePlayerMoney(stunedid,-10000);
new rand = random(sizeof(RandomCrimSpawns));
SetPlayerPos(stunedid, RandomCrimSpawns[rand][0], RandomCrimSpawns[rand][1], RandomCrimSpawns[rand][2]);
SetPlayerFacingAngle(stunedid, RandomCrimSpawns[rand][3]);
SetCameraBehindPlayer(stunedid);
SendClientMessage(stunedid,GCOLOR_GREY,"* You have been arrested! You lost 10000$ and 10 Score");
SetPlayerScore(playerid,GetPlayerScore(playerid)+10);
GivePlayerMoney(playerid,10000);
SendClientMessage(stunedid,GCOLOR_GREY,"* You arrested Criminal and received 10000$ and 10 Score");
}
else SendClientMessage(playerid, GCOLOR_RED, "ERROR: That player is not stunned!");
}
else SendClientMessage(playerid, GCOLOR_RED, "Usage: /arrest <stuned-playerid>");
}
else SendClientMessage(playerid, GCOLOR_RED, "ERROR: Only Enforcers can use this command!");
return 1;
}
Show me your StunPlayer function and also, set the timer for person, not for everyone because basically if one person gets stunned it does a timer to everyone who is stunned and there might be bugs like player unstuns after 0,1sec
|
if(Stuned[i] == 1)
Try this:
pawn Код:
|
C:\Users\Bruno\Downloads\GTA San Andreas\SAMP 0.3D\APB\apb.pwn(3765) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Give this error:
And btw, you forgot forward(); EDIT: Nvm, works! Thank you! |