SA-MP Forums Archive
OnPlayerCommandReceived - 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: OnPlayerCommandReceived (/showthread.php?tid=508229)



OnPlayerCommandReceived - biker122 - 21.04.2014

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(PlayerInfo[playerid][InDM] != 0 && PlayerInfo[playerid][pAdminLevel] < 1)
    {
        if(strcmp(cmdtext,"/leave") != 0 && strcmp(cmdtext,"/pm") != 0 && strcmp(cmdtext,"/report") != 0 && strcmp(cmdtext,"/irc") != 0)) //Line 1946
        {
            SendClientMessage(playerid,COLOR_RED,"[ERROR] "GREY"You cannot use these commands while on a DM!");
            return 0;
        }
    }
    if(PlayerInfo[playerid][InNRGParkour] != 0 || PlayerInfo[playerid][InParkour] != 0 || PlayerInfo[playerid][InBMXParkour] != 0 && PlayerInfo[playerid][pAdminLevel] < 1)
    {
        if(strcmp(cmdtext,"/leave") != 0 && strcmp(cmdtext,"/pm") != 0 && strcmp(cmdtext,"/report") != 0 && strcmp(cmdtext,"/irc") != 0)) //Line 1954
        {
            SendClientMessage(playerid,COLOR_RED,"[ERROR] "GREY"You cannot use these commands while on a parkour event!");
            return 0;
        }
    }
    if(PlayerInfo[playerid][Joined] == true && PlayerInfo[playerid][pAdminLevel] < 1)
    {
        if(strcmp(cmdtext,"/leaverace") != 0 && strcmp(cmdtext,"/pm") != 0 && strcmp(cmdtext,"/report") != 0 && strcmp(cmdtext,"/irc") != 0))//Line 1962
        {
            SendClientMessage(playerid,COLOR_RED,"[ERROR] "GREY"You cannot use these commands while on a race!");
            return 0;
        }
    }
    return 1;
}
So, I get these errors:
Код:
C:\Users\Matt\Desktop\samp03z_svr_R1_win32\gamemodes\stunting.pwn(1946) : error 029: invalid expression, assumed zero
C:\Users\Matt\Desktop\samp03z_svr_R1_win32\gamemodes\stunting.pwn(1954) : error 029: invalid expression, assumed zero
C:\Users\Matt\Desktop\samp03z_svr_R1_win32\gamemodes\stunting.pwn(1962) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Thanks in advance!


Re: OnPlayerCommandReceived - Mriss - 21.04.2014

I need the following lines please:

1946

1954

1962


Re: OnPlayerCommandReceived - biker122 - 21.04.2014

Go left on that code.


Re: OnPlayerCommandReceived - Stanford - 21.04.2014

It should be like this:

pawn Код:
if(strcmp(cmdtext,"/leaverace", true) == 0 || strcmp(cmdtext,"/pm", true) == 0 || strcmp(cmdtext,"/report", true) == 0 || strcmp(cmdtext,"/irc", true) == 0))//Line 1962
I hope that I helped!.


Re: OnPlayerCommandReceived - biker122 - 21.04.2014

Nope, Still doesn't work. Same errors


Re: OnPlayerCommandReceived - biker122 - 21.04.2014

BUMP!


Re: OnPlayerCommandReceived - Konstantinos - 21.04.2014

You have 1 extra closed ")" in those 3 lines.


Re: OnPlayerCommandReceived - Bingo - 21.04.2014

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(PlayerInfo[playerid][InDM] != 0 && PlayerInfo[playerid][pAdminLevel] < 1)
    {
        if(strcmp(cmdtext,"/leave") != 0 && strcmp(cmdtext,"/pm") != 0 && strcmp(cmdtext,"/report") != 0 && strcmp(cmdtext,"/irc") != 0) //Line 1946
        {
            SendClientMessage(playerid,COLOR_RED,"[ERROR] "GREY"You cannot use these commands while on a DM!");
            return 0;
        }
    }
    if(PlayerInfo[playerid][InNRGParkour] != 0 || PlayerInfo[playerid][InParkour] != 0 || PlayerInfo[playerid][InBMXParkour] != 0 && PlayerInfo[playerid][pAdminLevel] < 1)
    {
        if(strcmp(cmdtext,"/leave") != 0 && strcmp(cmdtext,"/pm") != 0 && strcmp(cmdtext,"/report") != 0 && strcmp(cmdtext,"/irc") != 0) //Line 1954
        {
            SendClientMessage(playerid,COLOR_RED,"[ERROR] "GREY"You cannot use these commands while on a parkour event!");
            return 0;
        }
    }
    if(PlayerInfo[playerid][Joined] == true && PlayerInfo[playerid][pAdminLevel] < 1)
    {
        if(strcmp(cmdtext,"/leaverace") != 0 && strcmp(cmdtext,"/pm") != 0 && strcmp(cmdtext,"/report") != 0 && strcmp(cmdtext,"/irc") != 0)//Line 1962
        {
            SendClientMessage(playerid,COLOR_RED,"[ERROR] "GREY"You cannot use these commands while on a race!");
            return 0;
        }
    }
    return 1;
}
Try now, Should work.