OnPlayerKeyStateChange help!
#1

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
Reply
#2

Defuse[0] = SetTimer("Defusing1", 160*1000, 0);

Maybe the name Defusing1is mis-spelled or something. Check your timer. Are they the same?
Reply
#3

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");
}
Reply
#4

Lemme check it
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)