Newbie Command Help
#1

Script:
Код:
	if (strcmp(cmd, "/n", true) == 0)
	{
		new msg[128];
		new pName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pName, sizeof(pName);
		format(msg, sizeof(msg), "NEWBIE: %s - %s", pName, result);
		SendClientMessageToAll(COLOR_LIME, msg);
		return 1;
	}
Errors:
Код:
C:\Users\Lenovo\Documents\dsifjdsfsdf\gamemodes\dgrp.pwn(24824) : error 001: expected token: ",", but found ";"
C:\Users\Lenovo\Documents\dsifjdsfsdf\gamemodes\dgrp.pwn(24825) : error 017: undefined symbol "result"
what's wrong?
Reply
#2

You never closed the GetPlayerName method.
You originally had "GetPlayerName(playerid, pName, sizeof(pName);"
When it should be "GetPlayerName(playerid, pName, sizeof(pName));"
Reply
#3

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
You never closed the GetPlayerName method.
You originally had "GetPlayerName(playerid, pName, sizeof(pName);"
When it should be "GetPlayerName(playerid, pName, sizeof(pName));"
Now when i do /n {newbie text} in the server, it doesnt show the text. All it shows is 'NEWBIE: Test_Person - '
Reply
#4

Here it is:

You need "zcmd" include and "sscanf2" include.
Also sscanf plugin.
PHP код:
CMD:n(playeridparams[])
{
    new 
msg[128], result[128];
    if(
sscanf(params,"s[128]"result)) return SendClientMessage(playerid, -1"USAGE: /n [text]");
    new 
pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNamesizeof(pName));//    )
    
format(msgsizeof(msg), "[NEWBIE]: %s - %s"pNameresult);//pName
    
SendClientMessageToAll(COLOR_LIMEmsg);
    return 
1;

Reply
#5

Oh yeah. You actually never defined what 'result' is and I am assuming 'result' is what you wish to send to everyone.

So when you send the 'msg' to everyone; it consists of nothing.

EDIT: Use ^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)