SA-MP Forums Archive
command crashes compiler - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: command crashes compiler (/showthread.php?tid=275369)



command crashes compiler - rekatluos - 09.08.2011

i tried importing the "view pms" function from ravens roleplay gm and im stuck when i create the command


pawn Код:
if(strcmp(cmd, "/togglepm", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if (PlayerInfo[playerid][pAdmin] >= 1339)
        (
            if(PlayerInfo[playerid][pViewPms] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "* You have Turned off the PM Messages!");
                PlayerInfo[playerid][pViewPms] = 0;
//              format(string, sizeof(string), "[ADMIN]: %s has turned off the PM Messages.",sendername);
//              ABroadCast(COLOR_LIGHTRED, string, 5);
            }
            else if(PlayerInfo[playerid][pViewPms] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "* You have Turned on the PM Messages!");
                PlayerInfo[playerid][pViewPms] = 1;
//              format(string, sizeof(string), "[ADMIN]: %s has turned on the PM Messages.",sendername);
//              ABroadCast(COLOR_LIGHTRED, string, 5);
            }
        }
    }
    return 1;
}

the compiler crashes,what am i doing wrong?


Re: command crashes compiler - Sascha - 09.08.2011

pawn Код:
if(PlayerInfo[playerid][pViewPms] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "* You have Turned off the PM Messages!");
                PlayerInfo[playerid][pViewPms] = 0;
//              format(string, sizeof(string), "[ADMIN]: %s has turned off the PM Messages.",sendername);
//              ABroadCast(COLOR_LIGHTRED, string, 5);
            }
should be
pawn Код:
if(PlayerInfo[playerid][pViewPms] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "* You have Turned off the PM Messages!");
                PlayerInfo[playerid][pViewPms] = 0;
//              format(string, sizeof(string), "[ADMIN]: %s has turned off the PM Messages.",sendername);
//              ABroadCast(COLOR_LIGHTRED, string, 5);
            }



Re: command crashes compiler - rekatluos - 09.08.2011

myea my mistake i got that wrong before copying it here,doesnt affect anything anyway ..still the same crash


Re: command crashes compiler - Sascha - 09.08.2011

yea thought so..
and
pawn Код:
if(IsPlayerConnected(playerid))
    {
is not necessary.. a player must be connected to use write a command... so just a senseless check...
but well just try to comment some parts out and see if it still crashes...
Comment each by each (always only change 1 line)
then you see what causes the crash


Re: command crashes compiler - rekatluos - 09.08.2011

well i tried commenting and i think the problem is these parts ->
pawn Код:
if(PlayerInfo[playerid][pViewPms] == 1)
but i dont get why ,i added the enum in
pawn Код:
enum pInfo
{
    pViewPms,
    pKey[128],
    pLevel,
(just a part of the enums,no need for all of them)

also
pawn Код:
PlayerInfo[playerid][pViewPms] = 0;
and the part for the pm function that checks and sends the pm messages to admins .

if i comment the entire command the server compiles just fine,so it must be here something wrong


Re: command crashes compiler - MadeMan - 09.08.2011

If you comment only the /togglepm cmd and leave other things (enum, /pm part etc) in place, it crashes?


Re: command crashes compiler - rekatluos - 09.08.2011

nope,as i just said ,it only crashes with the togglepm command ,i commented the entire command and it compiled perfectly . (by entire cmd i mean ONLY /togglepm , NOT /pm )


Re: command crashes compiler - MadeMan - 09.08.2011

pawn Код:
if (PlayerInfo[playerid][pAdmin] >= 1339)
( //   <------------ HERE



Re: command crashes compiler - rekatluos - 09.08.2011

hmm? i dont get it ,i tried commenting the padmin part ,it still crashes


Re: command crashes compiler - MadeMan - 09.08.2011

Try this

pawn Код:
if (PlayerInfo[playerid][pAdmin] >= 1339)
{
Changed '(' to '{'


Re: command crashes compiler - Sascha - 09.08.2011

you have to change the ( to a {
where "MadeMan" added the "<------------ HERE" comment


Код:
This forum requires that you wait 120 seconds between posts. Please try again in 65 seconds.
this is time wasting...

edit.. pfft too late


Re: command crashes compiler - rekatluos - 09.08.2011

i was about to punch myself in the face,good (and bad) thing it still crashes ,so that wasnt the only problem


Re: command crashes compiler - rekatluos - 09.08.2011

still nobody no idea?