Quick question
#1

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:
Код:
/login
/register
Reply
#2

cmdtext[PositionHere], as cmdtext[3].
Reply
#3

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")
Reply
#4

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

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

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

wtf, it's not resolve yet. Someone please help -.-
Reply
#8

bump... Really need it -,-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)