SA-MP Forums Archive
Strcmp. - 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: Strcmp. (/showthread.php?tid=333445)



Strcmp. - iOmar - 11.04.2012

I have Lux Admin System.It contain "dcmd" .I want to add /onduty cmd which uses strcmp. So how can i add strcmp cmds in Lux Admin System??


Re: Strcmp. - Ash. - 11.04.2012

Add the script into the callback 'OnPlayerCommandText'. Better yet you should convert your commands to something like ZCMD or Y_CMD, which steps away from the use of strcmp (thus faster).


Re: Strcmp. - .FuneraL. - 11.04.2012

Place it so then, and try to build :

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     if(strcmp("/yourcmd", cmdtext, true) == 0)
     {
       //Function
       return 1;
     }
     return 0;
}



Re: Strcmp. - iOmar - 11.04.2012

I get These Errors...
pawn Код:
D:\Game\SA-MP Files\UnderWars\filterscripts\LuxAdmin.pwn(7807) : error 017: undefined symbol "PlayerInfo"
D:\Game\SA-MP Files\UnderWars\filterscripts\LuxAdmin.pwn(7807) : warning 215: expression has no effect
D:\Game\SA-MP Files\UnderWars\filterscripts\LuxAdmin.pwn(7807) : error 001: expected token: ";", but found "]"
D:\Game\SA-MP Files\UnderWars\filterscripts\LuxAdmin.pwn(7807) : error 029: invalid expression, assumed zero
D:\Game\SA-MP Files\UnderWars\filterscripts\LuxAdmin.pwn(7807) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
In These:
pawn Код:
if(strcmp(cmd, "/onduty", true) == 0)
{
 Line # 7807   if(PlayerInfo[playerid][Level] >= 2) {
        CMDMessageToAdmins(playerid,"Now On Duty");   GetPlayerName(playerid, adminname, sizeof(adminname));
        for(new i = 0; i <= MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i) == 1)   {
        SetPlayerSkin(playerid,217); GivePlayerWeapon(playerid,38,500000); SetPlayerHealth(playerid,100000); SetPlayerColor(playerid,pink); format(string,256,"Administrator %s Has Now On Admin Duty",adminname);  SendClientMessage(i,pink,string);   }
        }
    } else  {
    SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");   }
    return 1;   }



Re: Strcmp. - .FuneraL. - 11.04.2012

pawn Код:
enum pInfo
{
        Level
};

new PlayerInfo[MAX_PLAYERS][pInfo];
Try.


Re: Strcmp. - TzAkS. - 11.04.2012

Quote:
Originally Posted by .FuneraL.
Посмотреть сообщение
pawn Код:
enum pInfo
{
        Level
};

new PlayerInfo[MAX_PLAYERS][pInfo];
Try.
That`s wrong.
You need to put your variable with players data,like PlayerData or whatever you have.


Re: Strcmp. - iOmar - 11.04.2012

How Bro?? I am Totally Newb


Re: Strcmp. - Phyrunx - 11.04.2012

Why not make a Command Using dcmd?
Though It will be Much faster and Flexible


Re: Strcmp. - Mark™ - 11.04.2012

Quote:
Originally Posted by Phyrunx
Посмотреть сообщение
Why not make a Command Using dcmd?
Though It will be Much faster and Flexible
Not faster than zcmd.


Re: Strcmp. - Ash. - 11.04.2012

Quote:
Originally Posted by Xtreme_playa
Посмотреть сообщение
Not faster than zcmd.
That helps this topic... how?

Anyway, you'll need to ensure that you make your command link up to the correct variable - as just copying it won't ensure that the variable are the same.