SA-MP Forums Archive
why this cmd got bugged? - 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: why this cmd got bugged? (/showthread.php?tid=542688)



why this cmd got bugged? - ThunderX - 21.10.2014

pawn Код:
CMD:event1(playerid, params[]) // SPEED-RACER (rules who got first place win!!!)
{
if(IsPlayerAdmin(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), -1397.782470, -203.723114, 1051.346801);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 93.569358);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), 7);
}
}else SendClientMessage(playerid,-1,"Only Rcon admins");
{
SetPlayerPos(playerid, -1397.782470, -203.723114, 1051.346801);
SetPlayerFacingAngle(playerid, 93.569358);
}
SetPlayerInterior(playerid, 7);
SendClientMessage(playerid, COLOR_RED, "!!Teleported!!");
return 1;
}
i try to make this cmd for admin only but still why all player that not admin can use?


Re: why this cmd got bugged? - Rudy_ - 21.10.2014

edit nvm


Re: why this cmd got bugged? - Neil. - 21.10.2014

Good indentation helps.

pawn Код:
CMD:event1(playerid, params[]) // SPEED-RACER (rules who got first place win!!!)
{
    if(IsPlayerAdmin(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SetVehiclePos(GetPlayerVehicleID(playerid), -1397.782470, -203.723114, 1051.346801);
            SetVehicleZAngle(GetPlayerVehicleID(playerid), 93.569358);
            LinkVehicleToInterior(GetPlayerVehicleID(playerid), 7);
           
            SetPlayerPos(playerid, -1397.782470, -203.723114, 1051.346801);
            SetPlayerFacingAngle(playerid, 93.569358);

            SetPlayerInterior(playerid, 7);
            SendClientMessage(playerid, COLOR_RED, "!!Teleported!!");
        }
    }
    else SendClientMessage(playerid,-1,"Only Rcon admins");
    return 1;
}



Re: why this cmd got bugged? - ThunderX - 21.10.2014

Thank you guys


Re: why this cmd got bugged? - nemesis- - 21.10.2014

You should probably use:

if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) otherwise you're allowing an rcon'd admin to execute the command while he's a passenger.