Strcmp.
#1

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

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).
Reply
#3

Place it so then, and try to build :

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

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

pawn Код:
enum pInfo
{
        Level
};

new PlayerInfo[MAX_PLAYERS][pInfo];
Try.
Reply
#6

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

How Bro?? I am Totally Newb
Reply
#8

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

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)