SA-MP Forums Archive
Need some /do 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: Need some /do help (/showthread.php?tid=351442)



Need some /do help - nogh445 - 16.06.2012

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


Re: Need some /do help - Nicks - 16.06.2012

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;
	}



Re: Need some /do help - ReneG - 16.06.2012

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;
        }
    }
}



Re: Need some /do help - ikey07 - 16.06.2012

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);


Re: Need some /do help - ReneG - 16.06.2012

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