Script Help
#1

Hello guys. Today i added a /o command. I also added a local chat... but i have a problem. When im
tryin to compile it it says "Undefined symbol: params" or something like that. Why is "params" and undefined
symbol??

Код:
public OnPlayerText(playerid, text[])
{
    new name[20];
    GetPlayerName(playerid,name,20);
    format(text,sizeof(text),"%s[%d]: %s",name,playerid,text);
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    for(new i = 0;i<MAX_PLAYERS;++i)
    {
        if(IsPlayerInRangeOfPoint(i,5,X,Y,Z)) SendClientMessage(i,-1,text);
        return 0;
    }
    return 1;
}
Код:
	if (strcmp("/o", cmdtext, true, 10) == 0)
	{
    	new str[128];
    	if(sscanf(params,"s[128]",str)) return SendClientMessage(playerid,-1,"USAGE: /o [TEXT]");
    	new name[20];
    	GetPlayerName(playerid,name,20);
    	format(str,sizeof(str),"[OOC] %s[%d]: %s",name,playerid,str);
    	SendClientMessageToAll(-1,str);
    	return 1;
	}
	return 0;
}
Reply
#2

Trying To Fix It Even never tested
Код:
	if (strcmp("/o", cmdtext, true, 10) == 0)
	{
    	new str[128];
    	if(sscanf(params,"s%",str)) return SendClientMessage(playerid,-1,"USAGE: /o [TEXT]");
    	new name[20];
    	GetPlayerName(playerid,name,20);
    	format(str,sizeof(str),"[OOC] %s[%d]: %s",name,playerid,str);
    	SendClientMessageToAll(-1,str);
    	return 1;
	}
	return 0;
}
Reply
#3

Quote:
Originally Posted by windrush
Посмотреть сообщение
Trying To Fix It Even never tested
Код:
	if (strcmp("/o", cmdtext, true, 10) == 0)
	{
    	new str[128];
    	if(sscanf(params,"s%",str)) return SendClientMessage(playerid,-1,"USAGE: /o [TEXT]");
    	new name[20];
    	GetPlayerName(playerid,name,20);
    	format(str,sizeof(str),"[OOC] %s[%d]: %s",name,playerid,str);
    	SendClientMessageToAll(-1,str);
    	return 1;
	}
	return 0;
}

Bro.. DONT EVER POST UNTESTED CODE! READ RULES SON!
Reply
#4

Quote:
Originally Posted by ~Pawno~
Посмотреть сообщение
Bro.. DONT EVER POST UNTESTED CODE! READ RULES SON!
Ok Bro Sorry Bro
Reply
#5

"params" is for ZCMD and such command processors, not strcmp.

@windrush:

Код:
(params,"s%",str))
You are very new into pawno, i see. Don't try to help unless you need help yourself.
Reply
#6

Quote:
Originally Posted by CmZxC
Посмотреть сообщение
"params" is for ZCMD and such command processors, not strcmp.

@windrush:

Код:
(params,"s%",str))
You are very new into pawno, i see. Don't try to help unless you need help yourself.
This guy is right, all I wanted to add is you need to replace "params" with "cmdtext", like this;
pawn Код:
if (strcmp("/o", cmdtext, true, 10) == 0)
    {
        new str[128];
        if(sscanf(cmdtext,"s[128]",str)) return SendClientMessage(playerid,-1,"USAGE: /o [TEXT]");
        new name[20];
        GetPlayerName(playerid,name,20);
        format(str,sizeof(str),"[OOC] %s[%d]: %s",name,playerid,str);
        SendClientMessageToAll(-1,str);
        return 1;
    }
Best regards,
Jesse
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)