#1

How i can make a command to work only on some names.For example my name is jimis and i have been added from admin to police dept and i can join.But if someone have name john then he cant join at lspd.
Reply
#2

Here you go:

pawn Код:
if (strcmp("/mycmd", cmdtext, true, 5) == 0)
    {
        new pname[20];
        GetPlayerName(playerid,pname,sizeof(pname));
        if(strcmp(pname,"jimis",true) == 0)//so jimis is name comparing with pname , that is player name using the command
        {
            //All other command codes goes here like:
            SendClientMessage(playerid,-1,"Hi jimis, command is only for you :).");
        }
        else
        {
            SendClientMessage(playerid,-1,"Command is only for jimis.");
        }
        return 1;
    }
Reply
#3

Thanks Shabi ,but can i add more names?
Reply
#4

pawn Код:
if(strcmp(pname,"jimis",true) == 0) && if(strcmp(pname,"name2",true) == 0) && if(strcmp(pname,"name3",true) == 0 )
The sign " && " means "AND".
Reply
#5

Ok,thanks
Reply
#6

but i have this problem ,twisted
if i put one name its work



C:\Users\Дзмзфсзт\Desktop\server4\gamemodes\newtes t.pwn(2813) : error 029: invalid expression, assumed zero
C:\Users\Дзмзфсзт\Desktop\server4\gamemodes\newtes t.pwn(2813) : warning 215: expression has no effect
C:\Users\Дзмзфсзт\Desktop\server4\gamemodes\newtes t.pwn(2813) : error 001: expected token: ";", but found "if"
C:\Users\Дзмзфсзт\Desktop\server4\gamemodes\newtes t.pwn(2813) : error 029: invalid expression, assumed zero
C:\Users\Дзмзфсзт\Desktop\server4\gamemodes\newtes t.pwn(2813) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)