Quick question - 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: Quick question (
/showthread.php?tid=197358)
Quick question -
blackwave - 08.12.2010
How do I do for check if player typed "certain" command? I tried:
Код:
if(cmdtext[] == "login") return false;
gave error: array must be indexed, something so. Any ideas? for check commands:
Re: Quick question -
CyNiC - 08.12.2010
cmdtext[PositionHere], as cmdtext[3].
Re: Quick question -
blackwave - 08.12.2010
Quote:
C:\DOCUME~1\FELIPE~1\Desktop\SERVER~1\FILTER~1\adm inx.pwn(352) : error 033: array must be indexed (variable "-unknown-")
|
pawn Код:
if(cmdtext[5] == "login")
Re: Quick question -
Mike_Peterson - 08.12.2010
Tell me what u wanna do with it?
cause now ur doing a check if cmdtext is equal to login
strcmp compares two strings i thought.. cmdtext and /login.
its kinda doing the same?
Re: Quick question -
Ash. - 08.12.2010
Quote:
Originally Posted by blackwave
pawn Код:
if(cmdtext[5] == "login")
|
You cannot do this - It will not compile.
if you want to compare a string for it to be the same, use strcmp...
pawn Код:
if(!strcmp("/login", cmdtext))
{
//Do your thing here
}
//Use cmdtext to return all data inside the variable
//Use cmdtext[cell] to return data in that cell
Re: Quick question -
blackwave - 08.12.2010
Sorry for time, was on dinner. I put a exception for all commands, cause I didn't want to do 1 per 1
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(PlayerInfo[playerid][Registrado] == 0) return SendClientMessage(playerid, cinza, "Registre-se antes de usar comandos"); // Register
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, cinza, "Logue-se antes de usar comandos"); // Login
And my register/login are on dcmd, and tried to make a exception. Im trying to do a exception for all commands, except register/login ones
Re: Quick question -
blackwave - 08.12.2010
wtf, it's not resolve yet. Someone please help -.-
Re: Quick question -
blackwave - 08.12.2010
bump... Really need it -,-