SA-MP Forums Archive
PM system 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: PM system problem (/showthread.php?tid=315981)



PM system problem - N0FeaR - 05.02.2012

Here error i get

Код:
C:\Users\Robin\Desktop\Ny mapp\test.pwn(59359) : warning 217: loose indentation
C:\Users\Robin\Desktop\Ny mapp\test.pwn(59359) : error 029: invalid expression, assumed zero
C:\Users\Robin\Desktop\Ny mapp\test.pwn(59359) : error 017: undefined symbol "cmd_pm"
C:\Users\Robin\Desktop\Ny mapp\test.pwn(59359) : error 029: invalid expression, assumed zero
C:\Users\Robin\Desktop\Ny mapp\test.pwn(59359) : fatal error 107: too many error messages on one line
cmd
Код:
}
CMD:pm(playerid, params[])
{
	if(gPlayerLogged{playerid} != 0)
	{
	    new str[128],id,pname[MAX_PLAYER_NAME], Message[128];
	    if(sscanf(params, "us[128]", id, Message))SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Message]");
	    else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");
	    else
	    {
	        GetPlayerName(id, str, 24);
	        format(str, sizeof(str), "(( PM To %s(%d): %s ))", str, id, Message);
	        GetPlayerName(id, str, 24);

	        format(str, sizeof(str), "(( PM To %s(%d): %s ))", str, id, Message);
	        SendClientMessage(playerid, COLOR_RED, str);
	        GetPlayerName(playerid, pname, sizeof(pname));

	        format(str, sizeof(str), "(( PM From %s(%d): %s ))", pname, playerid, Message);
	        SendClientMessage(id, COLOR_GREEN, str);
            for(new i=0; i < MAX_PLAYERS; i++)
            {
						if(IsPlayerConnected(i))
						{
							if(PlayerInfo[i][pViewPms] == 1 && PlayerInfo[i][pAdmin] >= 1)
							{
		                        format(string, sizeof(string), "[ADMIN]: %s (%d) Has sent a PM to %s (%d) - (%s)",sendername, playerid, giveplayer, giveplayerid, (result));
		                        SendClientMessage(i, COLOR_LIGHTRED, string);
							}
						}
					}
					return 1;
				}
			}
			else
			{
				format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}



Re: PM system problem - MP2 - 05.02.2012

Indent it properly and you shall find the answer.

http://en.wikipedia.org/wiki/Indent_style#Allman_style


Re: PM system problem - N0FeaR - 05.02.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
Indent it properly and you shall find the answer.

http://en.wikipedia.org/wiki/Indent_style#Allman_style
Well kinda tired right now to read all this. xD


Re: PM system problem - MP2 - 05.02.2012

You don't need to read the whole page, just glance at the example in the section I linked to. Indent it like that and it makes it extremely easy to find missing brackets.


Re: PM system problem - Tanush123 - 05.02.2012

umm
Код:
undefined symbol "cmd_pm"
do you even have zcmd included on top ?
pawn Код:
#include <zcmd>
if you do/do not and still have a problem just try using this


Re: PM system problem - N0FeaR - 05.02.2012

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
umm
Код:
undefined symbol "cmd_pm"
do you even have zcmd included on top ?
pawn Код:
#include <zcmd>
if you do/do not and still have a problem just try using this
Yes i have.


Re: PM system problem - Tanush123 - 05.02.2012

what line is the error?


Re: PM system problem - Finn - 05.02.2012

You have most probably forgotten a bracket somewhere, but your code is so fucking messy that no one can read it really.


Re: PM system problem - Danyal - 05.02.2012

pawn Код:
CMD:pm(playerid, params[])
{
    if(gPlayerLogged{playerid} != 0)
    {
        new str[128],id,pname[MAX_PLAYER_NAME], Message[128];
        if(sscanf(params, "us[128]", id, Message))SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Message]");
        else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");
        else
        {
            GetPlayerName(id, str, 24);
            format(str, sizeof(str), "(( PM To %s(%d): %s ))", str, id, Message);
            GetPlayerName(id, str, 24);

            format(str, sizeof(str), "(( PM To %s(%d): %s ))", str, id, Message);
            SendClientMessage(playerid, COLOR_RED, str);
            GetPlayerName(playerid, pname, sizeof(pname));

            format(str, sizeof(str), "(( PM From %s(%d): %s ))", pname, playerid, Message);
            SendClientMessage(id, COLOR_GREEN, str);
            for(new i=0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pViewPms] == 1 && PlayerInfo[i][pAdmin] >= 1)
                    {
                        format(string, sizeof(string), "[ADMIN]: %s (%d) Has sent a PM to %s (%d) - (%s)",sendername, playerid, giveplayer, giveplayerid, (result));
                        SendClientMessage(i, COLOR_LIGHTRED, string);
                    }
                }
            }
            return 1;
        }
    }
    else
    {
        format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
        SendClientMessage(playerid, COLOR_GRAD1, string);
    }
    return 1;
}
try this hope it works untested