SA-MP Forums Archive
Newbie Command Help - 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: Newbie Command Help (/showthread.php?tid=448624)



Newbie Command Help - Stupid - 05.07.2013

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?


Re: Newbie Command Help - EiresJason - 05.07.2013

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


Re: Newbie Command Help - Stupid - 05.07.2013

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 - '


Re: Newbie Command Help - ThePhenix - 05.07.2013

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;




Re: Newbie Command Help - EiresJason - 05.07.2013

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 ^