SA-MP Forums Archive
can't fine the problem - 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: can't fine the problem (/showthread.php?tid=327039)



can't fine the problem - Alexy_Dramon - 19.03.2012

Guys
when i trying make command with this code
Код:
if(isnull(params)) return SendClientMessage(playerid, COLOR_YELLOW " ",);
it's always show me this ERROR
Код:
C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(979) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(979) : warning 215: expression has no effect
C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(979) : error 001: expected token: ";", but found ")"
C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(979) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(979) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
what i need do to make it working?


Re: can't fine the problem - Alexy_Dramon - 19.03.2012

Код:
CMD:me1(playerid, params[])
{
	new isnull;
	new string[128],pname[MAX_PLAYER_NAME]; //this is enough for the line "%s %s"/we will gonna define pname with GetPlayerName
	GetPlayerName(playerid, pname, MAX_PLAYER_NAME); //pname is defined here with GetPlayerName
	if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /me <text>"); //if player didn't type something this message will be showed example if you type: /me only the word will be showed
	format(string, sizeof(string), "[ME]: %s %s", pname, params); //will gonna format the word "[ME]: %s %s" with string/pname/params and gonna use on SendClientMessageToAll - %s - inserts a string.
	SendClientMessageToAll(-1, string); //this will be sent to the everyone with format string.



Re: can't fine the problem - suhrab_mujeeb - 19.03.2012

You got an extra ',' after " ".


Re: can't fine the problem - Alexy_Dramon - 19.03.2012

Hmm? what u mean
sorry i'm not uder stand it newbie


Re: can't fine the problem - T0pAz - 19.03.2012

pawn Код:
if(isnull(params)) return SendClientMessage(playerid, COLOR_YELLOW, " ");



Re: can't fine the problem - Alexy_Dramon - 19.03.2012

still not working giving me same ERROR


Re: can't fine the problem - T0pAz - 19.03.2012

pawn Код:
CMD:me1( playerid, params[] )
{
    new isnull;
    new string[128], pname[MAX_PLAYER_NAME];                                                                /* this is enough for the line "%s %s"/we will gonna define pname with GetPlayerName */
    GetPlayerName( playerid, pname, MAX_PLAYER_NAME );                                                      /* pname is defined here with GetPlayerName */
    if ( isnull( params ) ) return(SendClientMessage( playerid, COLOR_RED, "SYNTAX: /me <text>" ) );        /* if player didn't type something this message will be showed example if you type: /me only the word will be showed */
    format( string, sizeof(string), "[ME]: %s %s", pname, params );                                         /* will gonna format the word "[ME]: %s %s" with string/pname/params and gonna use on SendClientMessageToAll - %s - inserts a string. */
    SendClientMessageToAll( -1, string );                                                                   /* this will be sent to the everyone with format string. */
    return(1);
}



Re: can't fine the problem - Abravanel - 19.03.2012

you defined 'isnull' ?

at the top of its script:

pawn Код:
#if !defined isnull
    #define isnull(%1) \
                ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
pawn Код:
CMD:me1(playerid, params[])
{
    new string[128], pname[MAX_PLAYER_NAME]; //this is enough for the line "%s %s"/we will gonna define pname with GetPlayerName
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME); //pname is defined here with GetPlayerName
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /me <text>"); //if player didn't type something this message will be showed example if you type: /me only the word will be showed
    format(string, sizeof(string), "[ME]: %s %s", pname, params); //will gonna format the word "[ME]: %s %s" with string/pname/params and gonna use on SendClientMessageToAll - %s - inserts a string.
    SendClientMessageToAll(-1, string); //this will be sent to the everyone with format string.
    return true;
}
or use sscanf.