Command Scripting Help
#1

I want to add a command to my script that is only for admins, so when they type /jetpack they will spawn a jetpack. Does anyone know how I can do this?
Reply
#2

If (IsPlayerAdmin(playerid);
Reply
#3

Use this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/jetpack", cmdtext, true, 10) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid,X,Y,Z);
        CreatePickup(370,2,X,Y,Z);
        SendClientMessage(playerid, COLOR_GREY, "* Spawned jetpack");

        return 1;
    }
        return 1;
}
    return 1;
}
Reply
#4

pawn Код:
if(strcmp(cmd, "/jetpack", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        GivePlayerWeapon(playerid, 19, 1);
        SendClientMessage(playerid, 0xDEEE20FF, "Spawned a Jetpack");
     }
     return 1;
}
or

pawn Код:
CMD:jetpack(playerid, params[]) {
    if(IsPlayerAdmin(playerid)) {
        GivePlayerWeapon(playerid, 19, 1);
        SendClientMessage(playerid, 0xDEEE20FF, "Spawned a Jetpack");
    }
    return 1;
}
Reply
#5

pawn Код:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)