command crashes compiler
#1

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?
Reply
#2

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);
            }
Reply
#3

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

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
Reply
#5

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
Reply
#6

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

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 )
Reply
#8

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

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

Try this

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

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
Reply
#12

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

still nobody no idea?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)