OnPlayerKeyStateChange help! - 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)
+--- Thread: OnPlayerKeyStateChange help! (
/showthread.php?tid=533118)
OnPlayerKeyStateChange help! -
Meow22 - 22.08.2014
pawn Код:
if(newkeys == KEY_SECONDARY_ATTACK)
{
if(IsPlayerInDynamicCP(playerid, PlantbombCP) && (gTeam[playerid] == TERRORIST && (BombPlanted == INVALID_PLAYER_ID)))
{
Bomb = CreateObject(3786,259.2780,1855.8953,8.7578,196.8689,0,0, 100.0);
BombExplodeTimer = SetTimer("BombExplodes",170*1000,0);
ExplodeBombTimer = 0;
Defuse[0] = SetTimer("Defusing1", 160*1000, 0);
Defuse[1] =1;
GameTextForAll("~r~Terrorists planted a bomb in ~b~Army base~n~~g~army try to defuse it~n~ ~r~stand in checkpoint for 30 seconds to defuse it!", 3000, 3);
BombPlanted = playerid;
}
else if(IsPlayerInDynamicCP(playerid, PlantbombCP) && (gTeam[playerid] == TERRORIST && (BombPlanted != INVALID_PLAYER_ID))) return SendClientMessage(playerid, COLOR_RED, "The bomb is already planted!");
}
Please Help this KeyState is not working ingame
Re: OnPlayerKeyStateChange help! -
iSkate - 22.08.2014
Defuse[0] = SetTimer("Defusing1", 160*1000, 0);
Maybe the name
Defusing1is mis-spelled or something. Check your timer. Are they the same?
Re: OnPlayerKeyStateChange help! -
Jefff - 22.08.2014
Use debug and show prints here
pawn Код:
if(newkeys&KEY_SECONDARY_ATTACK)
{
print("Key match");
if(IsPlayerInDynamicCP(playerid, PlantbombCP))
{
print("Player in checkpoint match");
if(gTeam[playerid] == TERRORIST && BombPlanted == INVALID_PLAYER_ID)
{
print("Bomb planted");
BombPlanted = playerid;
Bomb = CreateObject(3786,259.2780,1855.8953,8.7578,196.8689,0,0, 100.0);
BombExplodeTimer = SetTimer("BombExplodes",170*1000,0);
ExplodeBombTimer = 0;
Defuse[0] = SetTimer("Defusing1", 160*1000, 0);
Defuse[1] = 1;
GameTextForAll("~r~Terrorists planted a bomb in ~b~Army base~n~~g~army try to defuse it~n~ ~r~stand in checkpoint for 30 seconds to defuse it!", 3000, 3);
}
else SendClientMessage(playerid, COLOR_RED, "The bomb is already planted!");
}
print("Done");
}
Re: OnPlayerKeyStateChange help! -
Meow22 - 22.08.2014
Lemme check it
Re: OnPlayerKeyStateChange help! -
Meow22 - 22.08.2014
Not working This is the CMD exact which is working
pawn Код:
CMD:c4(playerid, params[])
{
if(IsPlayerInDynamicCP(playerid, PlantbombCP) && (gTeam[playerid] == TERRORIST && (BombPlanted == INVALID_PLAYER_ID)))
{
if(GotC4[playerid] == 0) return SendClientMessage(playerid,-1,"You Need to Buy C4 from GTA3 Logo First");
Bomb = CreateObject(3786,259.2780,1855.8953,8.7578,196.8689,0,0, 100.0);
BombExplodeTimer = SetTimer("BombExplodes",170*1000,0);
ExplodeBombTimer = 0;
Defuse[0] = SetTimer("Defusing1", 160*1000, 0);
Defuse[1] =1;
GameTextForAll("~r~Terrorists planted a bomb in ~b~Army base~n~~g~army try to defuse it~n~ ~r~stand in checkpoint for 30 seconds to defuse it!", 3000, 3);
BombPlanted = playerid;
}
else if(IsPlayerInDynamicCP(playerid, PlantbombCP) && (gTeam[playerid] == TERRORIST && (BombPlanted != INVALID_PLAYER_ID))) return SendClientMessage(playerid, COLOR_RED, "The bomb is already planted!");
return 1;
}
forward Defusing1();
public Defusing1()
{
GameTextForAll("Army Failed to defuse the bomb", 2000, 3);
Defusing = 0;
Defuse[1]=0;
}
forward BombExplodes();
public BombExplodes()
{
GameTextForAll("Bomb explodes in 10 seconds!!, get the hell out of there!", 3000, 3);
return 1;
}