team - 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: team (
/showthread.php?tid=327209)
team -
jimis - 20.03.2012
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.
Re: team -
Shabi RoxX - 20.03.2012
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;
}
Re: team -
jimis - 20.03.2012
Thanks Shabi ,but can i add more names?
Re: team -
Twisted_Insane - 20.03.2012
pawn Код:
if(strcmp(pname,"jimis",true) == 0) && if(strcmp(pname,"name2",true) == 0) && if(strcmp(pname,"name3",true) == 0 )
The sign " && " means "AND".
Re: team -
jimis - 21.03.2012
Ok,thanks
Re: team -
jimis - 21.03.2012
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.