#1

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

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

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

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

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

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

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

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.
Reply
#9

You didn't put that ?

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)