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



Help! - Sharp19 - 18.05.2013

Hey guys, i am trying to make an event system but i need to make the command only works for level 2 and higher admins, but its giving me some errors please help me.

pawn Код:
CMD:dm(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin]>2) return SendClientMessage(playerid, 0xD90005FF, "ERROR! You need to be an admin to use this command!!");
    else
    SetPlayerPos(playerid, 2689.9565, -1669.9923, 1.8278);
    GameTextForPlayer(playerid, "~g~You are now on DM event!");
    SendClientMessage(playerid, 0xfff000, "***Welcome to the DM event.");
    SetPlayerSkin(playerid, 287);
    SetPlayerHealth(playerid, 100);
    return 1;
}
And the errors that i got is

Код:
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(8) : error 029: invalid expression, assumed zero
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(8) : warning 215: expression has no effect
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(8) : error 001: expected token: ";", but found "]"
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(8) : error 029: invalid expression, assumed zero
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(8) : fatal error 107: too many error messages on one line



Re: Help! - LilBob - 18.05.2013

Use this:

pawn Код:
CMD:dm(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin]>2)
    {
     SendClientMessage(playerid, 0xD90005FF, "ERROR! You need to be an admin to use this command!!");
    }
    else
    {
    SetPlayerPos(playerid, 2689.9565, -1669.9923, 1.8278);
    GameTextForPlayer(playerid, "~g~You are now on DM event!");
    SendClientMessage(playerid, 0xfff000, "***Welcome to the DM event.");
    SetPlayerSkin(playerid, 287);
    SetPlayerHealth(playerid, 100);
    return 1;
    }
}



Re: Help! - zDivine - 18.05.2013

pawn Код:
CMD:dm(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, 0xD90005FF, "ERROR! You need to be an admin to use this command!!");
   
    SetPlayerPos(playerid, 2689.9565, -1669.9923, 1.8278);
    GameTextForPlayer(playerid, "~g~You are now on DM event!");
    SendClientMessage(playerid, 0xfff000, "***Welcome to the DM event.");
    SetPlayerSkin(playerid, 287);
    SetPlayerHealth(playerid, 100);
    return 1;
}



Re: Help! - zDivine - 18.05.2013

Quote:
Originally Posted by LilBob
Посмотреть сообщение
Use this:

pawn Код:
CMD:dm(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin]>2)
    {
     SendClientMessage(playerid, 0xD90005FF, "ERROR! You need to be an admin to use this command!!");
    }
    else
    {
    SetPlayerPos(playerid, 2689.9565, -1669.9923, 1.8278);
    GameTextForPlayer(playerid, "~g~You are now on DM event!");
    SendClientMessage(playerid, 0xfff000, "***Welcome to the DM event.");
    SetPlayerSkin(playerid, 287);
    SetPlayerHealth(playerid, 100);
    return 1;
    }
}
This is wrong. Because you are saying if they are an Admin (greater than 2), then send the message that they're NOT an Admin. And if their not an Admin, put them in the event.


Re: Help! - Sharp19 - 18.05.2013

Still nothing happened, i am getting the same errors idk why


Re: Help! - zDivine - 18.05.2013

Quote:
Originally Posted by Sharp19
Посмотреть сообщение
Still nothing happened, i am getting the same errors idk why
Did you try my code?


Re: Help! - LilBob - 18.05.2013

try with both codes sharp, for mine, just change the > into a <


Re: Help! - Sharp19 - 18.05.2013

I used both but still nothing happened.

Код:
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : error 017: undefined symbol "PlayerInfo"
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : warning 215: expression has no effect
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : error 001: expected token: ";", but found "]"
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : error 029: invalid expression, assumed zero
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : fatal error 107: too many error messages on one line
These errors appear after using both code.


Re: Help! - LilBob - 18.05.2013

You didn't put that ?

pawn Код:
enum pinfo
{
pAdmin,
};
new PlayerInfo[MAX_PLAYERS][pInfo];



Re: Help! - zDivine - 18.05.2013

Quote:
Originally Posted by Sharp19
Посмотреть сообщение
I used both but still nothing happened.

Код:
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : error 017: undefined symbol "PlayerInfo"
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : warning 215: expression has no effect
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : error 001: expected token: ";", but found "]"
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : error 029: invalid expression, assumed zero
C:\Users\SuJan\Desktop\Trucking\filterscripts\ann.pwn(6) : fatal error 107: too many error messages on one line
These errors appear after using both code.
Do you have a PlayerInfo enum?