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



Can someone help? - 06leachr - 06.01.2011

Hello guys. I have a filterscript which spawns cars. I wish to make the command admin only. The script is as follows:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/burnsycar", true))
    {
        ShowPlayerDialog(playerid, Dialog, DIALOG_STYLE_LIST, "Car spawner", "Infernus\nTurismo\nPhoenix\nCheetah\nBanshee\nEuros\nBuffalo\nKart\nHotknife\nHustler\nComet\nStallion\nSunrise\nSandking", "Spawn", "Cancel");
        return 1;
    }
    return 0;
}
In my gamemode we define admins as the follows:

pawn Код:
if( Player[playerid][AdminLevel] >= 1 && Player[playerid][AdminDuty] > 0 )
Can someone tell me where to stick it in the script without getting errors like the below?

pawn Код:
C:\Users\Robert\Desktop\Grand Theft Auto San Andreas NEW\server\filterscripts\spawner.pwn(25) : error 017: undefined symbol "Player"
C:\Users\Robert\Desktop\Grand Theft Auto San Andreas NEW\server\filterscripts\spawner.pwn(25) : warning 215: expression has no effect
C:\Users\Robert\Desktop\Grand Theft Auto San Andreas NEW\server\filterscripts\spawner.pwn(25) : error 001: expected token: ";", but found "]"
C:\Users\Robert\Desktop\Grand Theft Auto San Andreas NEW\server\filterscripts\spawner.pwn(25) : error 029: invalid expression, assumed zero
C:\Users\Robert\Desktop\Grand Theft Auto San Andreas NEW\server\filterscripts\spawner.pwn(25) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Thanks, Robert.


Re: Can someone help? - DarrenThayer - 06.01.2011

The enum is not called "Player" are you sure its not "PlayerInfo"? ( i am assuming you are using Godfather, i apologize if you are not)


Re: Can someone help? - bartje01 - 06.01.2011

I think it's PlayerInfo or pInfo.


Re: Can someone help? - DarrenThayer - 06.01.2011

Quote:
Originally Posted by bartje01
Посмотреть сообщение
I think it's PlayerInfo or pInfo.
It will be whatever he named it...

He needs to check where the enum was made, if it is GF its likely to be PlayerInfo, although if its not he is likely to be different.


Re: Can someone help? - bartje01 - 06.01.2011

Quote:
Originally Posted by DarrenThayer
Посмотреть сообщение
It will be whatever he named it...

He needs to check where the enum was made, if it is GF its likely to be PlayerInfo, although if its not he is likely to be different.
I'm not sure if he made his GM though


Re: Can someone help? - DarrenThayer - 06.01.2011

Quote:
Originally Posted by bartje01
Посмотреть сообщение
I'm not sure if he made his GM though
hence my " ( i am assuming you are using Godfather, i apologize if you are not)"


Re: Can someone help? - iggy1 - 06.01.2011

When you do sort out your variables you would want something like this,
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/burnsycar", true))
    {
        if( Player[playerid][AdminLevel] > 0 && Player[playerid][AdminDuty] > 0 )//change for the proper variable.
        {
            ShowPlayerDialog(playerid, Dialog, DIALOG_STYLE_LIST, "Car spawner", "Infernus\nTurismo\nPhoenix\nCheetah\nBanshee\nEuros\nBuffalo\nKart\nHotknife\nHustler\nComet\nStallion\nSunrise\nSandking", "Spawn", "Cancel");
            return 1;
        }
        else return 0;//or send a message "you're not admin F**k OFF! (or something along those lines)
    }
    return 0;
}



Re: Can someone help? - 06leachr - 06.01.2011

Thanks for all your replies, I'm not using GF.

In my command for kick, I have the following,

pawn Код:
{
    new id, reason[128], string[ 128 ];
    if( sscanf( params, "us", id, reason) )
    {
        if( Player[playerid][AdminLevel] >= 1 && Player[playerid][AdminDuty] > 0 )
        {
            SendClientMessage( playerid, INFO_GREY, "SYNTAX: /kick <playerid/name> <reason>"  );
        }
    }
So does this mean I should be using Player?