SA-MP Forums Archive
Help with /duty command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with /duty command (/showthread.php?tid=225849)



Help with /duty command - Markx - 14.02.2011

Help please.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/duty", true))
    {
        if (IsPlayerLAdmin(playerid)
        {
        new message[256], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid,name,sizeof(name));
        format(message,sizeof(message),"%s is not on ~r~Duty!",name);
        GameTextForAll(playerid,message,10000,6);
        return 1;
        }
    }
    return 1;

    if(!strcmp(cmdtext, "/para", true))
    {
    SendClientMessage(playerid,COLOR_RED, "Enjoy BASE Jumping!");
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
    GivePlayerWeapon(playerid, 46, 500);
    return 1;
    }
Errors:

Код:
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(542) : error 001: expected token: ")", but found "{"
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(546) : error 035: argument type mismatch (argument 1)
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(552) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Thanks for help.


Re: Help with /duty command - _Tommy - 14.02.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/duty", true))
    {
        new message[256], name[MAX_PLAYER_NAME];
        if (!IsPlayerLAdmin(playerid)) SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an admin!");
        GetPlayerName(playerid,name,sizeof(name));
        format(message,sizeof(message),"%s is not on ~r~Duty!",name);
        GameTextForAll(message,10000,6);
        return 1;
    }
    if(!strcmp(cmdtext, "/para", true))
    {
        SendClientMessage(playerid,COLOR_RED, "Enjoy BASE Jumping!");
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
        GivePlayerWeapon(playerid, 46, 500);
        return 1;
    }
    return 1;
}



Re: Help with /duty command - SkizzoTrick - 14.02.2011

if(IsPlayerLAdmin(playerid))

you forgot a ")"


Re: Help with /duty command - Markx - 15.02.2011

whats wrong now

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/duty", true))
    {
        new message[256], name[MAX_PLAYER_NAME];
        if (!IsPlayerLAdmin(playerid)) SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an admin!");
        GetPlayerName(playerid,name,sizeof(name));
        format(message,sizeof(message),"%s is not on ~r~Duty!",name);
        GameTextForAll(message,10000,6);
        return 1;
    }
    if(!strcmp(cmdtext, "/para", true))
    {
        SendClientMessage(playerid,COLOR_RED, "Enjoy BASE Jumping!");
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
        GivePlayerWeapon(playerid, 46, 500);
        return 1;
    }
    return 1;
}
   
    if(!strcmp(cmdtext, "/chiliad1", true))
    {
    FreezePlayer(playerid);
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
    SetPlayerPos(playerid, -2312.3948,-1663.9303,623.5829);
    SetPlayerFacingAngle(playerid, 152.0016);
    GivePlayerWeapon(playerid, 46, 500);
    return 1;
    }

    if(!strcmp(cmdtext, "/chiliad", true))
    {
    FreezePlayer(playerid);
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
    SetPlayerPos(playerid, -2235.6418,-1738.8710,480.8144);
    SetPlayerFacingAngle(playerid, 206.4987);
    GivePlayerWeapon(playerid, 46, 500);
    return 1;
    }
   
    if(!strcmp(cmdtext, "/tele", true))
    {
    GivePlayerWeapon(playerid, 46, 500);
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "Teleports", "{FF0000}/cave[1-30] \n{FF0000}/jump[1-100] \n{FF0000}Cooming Soon!\n{FF0000}Enjoy our server.", "Okay", "Cancel");
    return 1;
    }
    return 0;
}
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(55 : error 010: invalid function or declaration
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(561) : error 021: symbol already defined: "PlayerPlaySound"
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(565) : error 010: invalid function or declaration
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(56 : error 010: invalid function or declaration
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(571) : error 021: symbol already defined: "PlayerPlaySound"
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(575) : error 010: invalid function or declaration
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(57 : error 010: invalid function or declaration
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(583) : error 010: invalid function or declaration
C:\Users\Marko\Desktop\Base Jmping server\gamemodes\onlybase.pwn(585) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


9 Errors.


Re: Help with /duty command - t.fp - 15.02.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/duty", true))
    {
        new message[256], name[MAX_PLAYER_NAME];
        if (!IsPlayerLAdmin(playerid)) SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an admin!");
        GetPlayerName(playerid,name,sizeof(name));
        format(message,sizeof(message),"%s is not on ~r~Duty!",name);
        GameTextForAll(message,10000,6);
        return 1;
    }
    if(!strcmp(cmdtext, "/para", true))
    {
        SendClientMessage(playerid,COLOR_RED, "Enjoy BASE Jumping!");
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
        GivePlayerWeapon(playerid, 46, 500);
        return 1;
    }

    if(!strcmp(cmdtext, "/chiliad1", true))
    {
    FreezePlayer(playerid);
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
    SetPlayerPos(playerid, -2312.3948,-1663.9303,623.5829);
    SetPlayerFacingAngle(playerid, 152.0016);
    GivePlayerWeapon(playerid, 46, 500);
    return 1;
    }

    if(!strcmp(cmdtext, "/chiliad", true))
    {
    FreezePlayer(playerid);
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
    SetPlayerPos(playerid, -2235.6418,-1738.8710,480.8144);
    SetPlayerFacingAngle(playerid, 206.4987);
    GivePlayerWeapon(playerid, 46, 500);
    return 1;
    }

    if(!strcmp(cmdtext, "/tele", true))
    {
    GivePlayerWeapon(playerid, 46, 500);
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "Teleports", "{FF0000}/cave[1-30] \n{FF0000}/jump[1-100] \n{FF0000}Cooming Soon!\n{FF0000}Enjoy our server.", "Okay", "Cancel");
    return 1;
    }
    return 0;
}



Re: Help with /duty command - Markx - 15.02.2011

Thanks mate, what was wrong?


Re: Help with /duty command - t.fp - 15.02.2011

pawn Код:
if(!strcmp(cmdtext, "/para", true))
    {
        SendClientMessage(playerid,COLOR_RED, "Enjoy BASE Jumping!");
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
        GivePlayerWeapon(playerid, 46, 500);
        return 1;
    }
    return 1;
}
Used a return 2 times


Re: Help with /duty command - Markx - 15.02.2011

ohhh okay, thanks again


Re: Help with /duty command - t.fp - 15.02.2011

np