Need some /do help
#1

Here is the code:
pawn Код:
CMD:do(playerid, params[])
{
    new
        string[128],
        action[100];
    if(sscanf(params, "s[100]", action))
    {
        SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /do [action]");
        return 1;
    }
    else
    {
        format(string, sizeof(string), "* %s ((%s))", action, GetName);//--------Line 1499
        ProxDetector(30, playerid, string, COLOR_PURPLE);
    }
    return 1;
}

Here are the errors:
Код:
C:\Users\user\Desktop\KM\pawno\KM.pwn(1499) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Please Help
Reply
#2

Try This code''
Код:
	}
	if(strcmp(cmd, "/do", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
	            return 1;
	        }
	        GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /do [local chat]");
				return 1;
			}
			if(PlayerInfo[playerid][pMask] == 1)
			{
			    format(string, sizeof(string), "* %s (( Stranger ))", result);
			}
			else
			{
				format(string, sizeof(string), "* %s (( %s ))",result , sendername);
			}
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
		return 1;
	}
Reply
#3

Quote:
Originally Posted by Nicks
Посмотреть сообщение
Try This code''
Код:
	}
	if(strcmp(cmd, "/do", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
	            return 1;
	        }
	        GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /do [local chat]");
				return 1;
			}
			if(PlayerInfo[playerid][pMask] == 1)
			{
			    format(string, sizeof(string), "* %s (( Stranger ))", result);
			}
			else
			{
				format(string, sizeof(string), "* %s (( %s ))",result , sendername);
			}
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
		return 1;
	}
Don't take that code.

Make sure these are already somewhere in your script.
pawn Код:
stock GetName(playerid)
{
    new string[MAX_PLAYER_NAME];
    GetPlayerName(playerid,string,sizeof(string));
    strreplace(string,'_',' ');
    return string;
}
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}
Reply
#4

Instead of pasting /do cmd from GF edit, you could explain to topic author that ProxDetector(); is a custom function which requires more parameters ProxDetector(30, playerid, string, COLOR_PURPLE, COLOR_PURPLE,, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
Reply
#5

^^ That ProxDetector is the one from the tutorial in my signature.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)