Bombing only for admin
#1

Hello, I saw this filterscript :https://sampforum.blast.hk/showthread.php?tid=44126

I just have a question : How can I restrict bombing for admins ? I want that if the player is not admin, he can't use this function.

Thanks =)
Reply
#2

well... that would be quite easy. Just use an "if" statement to check if the player using the command is an admin

pawn Код:
if(IsPlayerAdmin(playerid)) //this checks if the player is an RCON admin
{
    //code goes here
}
else
{
    SendClientMessage(playerid, COLOR_RED, "your not an admin!");
}
return 1;
}
Reply
#3

I tryed that, I have some compilation errors. Does it works for you ? Maybe, I didi't do it very well.

Can you try it please ? Thanks =)
Reply
#4

How about posting what errors your received.
Reply
#5

Код:
Current directory: C:\Documents and Settings\Ludovic\Bureau\GTA\samp03csvr_R2-2_win32\pawno
Bombardier.pwn(38) : error 010: invalid function or declaration
Bombardier.pwn(390) : warning 213: tag mismatch
Bombardier.pwn(454) : error 054: unmatched closing brace ("}")
Bombardier.pwn(455) : error 010: invalid function or declaration
Bombardier.pwn(459) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
================ READY ================
Reply
#6

Sorry, havent checked the topic for a while so I didnt see your question.
For things like this I addded the IsPlayerAllowedToDropBomb function at the very end of the script.

pawn Код:
IsPlayerAllowedToDropBomb(playerid)
{
        #pragma unused playerid
        // This is used to restrict the use of bombs for single players
        // For example to make them available for special teams only, ...
        // bptype[playerid] is the index of the selected bomb
        return 1;
}
So just change the
return 1;
to
return IsPlayerAdmin(playerid);

the rest is done by the script
Reply
#7

Thanks, it works. But, can I hide the textbox (where I choose the bomb type, sorry for my bad english x)) ?

Thanks again =)
Reply
#8

No problem!
To disable the textdraws for non-admins, you can sinply add this to the top of the OnPlayerEnterVehicle callback (line 137):
pawn Код:
if (!IsPlayerAdmin(playerid)) return 1;
This will stop any output for non-admins, as the function ends before it can initialize all the textdraw stuff.

(Whoa I really feel ashamed for the ugly scripting style, this really needs a rescripted 0.98 with my up-to-date knowledge )
Reply
#9

This means that if the player i not admin, the returned value will be 1 (true), so he will be able to drop bombs I think ^^ I will try with return 0

I'll tell you how it works !

There is a problem, with 1 or 0

Код:
@Bombardier.pwn(451) : warning 209: function "IsPlayerAllowedToDropBomb" should return a value
Reply
#10

It works with
Код:
return IsPlayerAdmin(playerid);
But it doesn't hide the Textdraw when he player is not an admin. Do you know how to do it ?

Thanks =)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)