/laseron for Admins
#1

How can i add that Admins have a Laser on his Weapons like /laseron and that he can change his Lasercolor with /lasercolor, and that he can turn off his Lasercolor with /laseroff. I have see this on a other Server, but i dont know how i can scripting this.
Reply
#2

You can improvise with AttachObjectToPlayer, but this will be realy hard to be made, because every single weapon will need it's own coordinates
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=373380

I mean that so we that, but that it get only for Admins, and i have no idea how to scripting it, and yep this is hard.
Reply
#4

Then here's an example how to make it for RCON admins so see

pawn Код:
CMD:laseron(playerid, params[])
{
      //the code is here blah blah
      return 1;
}
To make this Command only for admins add this : if(IsPlayerAdmin(playerid))

It should look like this:

pawn Код:
CMD:laseron(playerid, params[])
{
     if(IsPlayerAdmin(playerid))
     {
            // The code is here blah blah
     }
     return 1;  
}
I don't know how you defined the admin level in your Game Mode, so I can't help much.

Example : I've defined the admin level as "PlayerInfo[playerid][AdminLevel]"

And the CMD will look like this :

pawn Код:
CMD:laseron(playerid, params[])
{
     if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] >= 1) // If the player is RCON admin or lvl 1 + Admin
     {
            // The code is here blah blah
     }
     return 1;  
}
Reply
#5

I think this is whole system and you can just download this , edit it whitout removing the credits.
Reply
#6

Quote:

CMD:laseron(playerid, params[])
{
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "color", GetPVarInt(playerid, "color"));
return 1;
}

CMD:laseroff(playerid, params[])
{
SetPVarInt(playerid, "laser", 0);
RemovePlayerAttachedObject(playerid, 0);
return 1;
}

CMD:lasercol(playerid, params[])
{
new color[16];
if(sscanf(params, "s[15]", color)) return SendClientMessage(playerid, C_GREY, "USAGE: /lasercol [color]");

if(!strcmp(color, "red", true)) SetPVarInt(playerid, "color", 18643);
else if(!strcmp(color, "blue", true)) SetPVarInt(playerid, "color", 19080);
else if(!strcmp(color, "pink", true)) SetPVarInt(playerid, "color", 19081);
else if(!strcmp(color, "orange", true)) SetPVarInt(playerid, "color", 19082);
else if(!strcmp(color, "green", true)) SetPVarInt(playerid, "color", 19083);
else if(!strcmp(color, "yellow", true)) SetPVarInt(playerid, "color", 19084);
else SendClientMessage(playerid, C_VIOLET, "Color not available!");
return 1;
}

So i have that, but i dont know, what i must make that only Admins can use it. xD
Reply
#7

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
So i have that, but i dont know, what i must make that only Admins can use it. xD
pawn Код:
CMD:laseron(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        SetPVarInt(playerid, "laser", 1);
        SetPVarInt(playerid, "color", GetPVarInt(playerid, "color"));
    }
    SendClientMessage(playerid,C_VIOLET,"You are not an admin");
    return 1;
}

CMD:laseroff(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        SetPVarInt(playerid, "laser", 0);
        RemovePlayerAttachedObject(playerid, 0);
    }
    SendClientMessage(playerid,C_VIOLET,"You are not an admin");
    return 1;
}

CMD:lasercol(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new color[16];
        if(sscanf(params, "s[15]", color)) return SendClientMessage(playerid, C_GREY, "USAGE: /lasercol [color]");

        if(!strcmp(color, "red", true)) SetPVarInt(playerid, "color", 18643);
        else if(!strcmp(color, "blue", true)) SetPVarInt(playerid, "color", 19080);
        else if(!strcmp(color, "pink", true)) SetPVarInt(playerid, "color", 19081);
        else if(!strcmp(color, "orange", true)) SetPVarInt(playerid, "color", 19082);
        else if(!strcmp(color, "green", true)) SetPVarInt(playerid, "color", 19083);
        else if(!strcmp(color, "yellow", true)) SetPVarInt(playerid, "color", 19084);
        else SendClientMessage(playerid, C_VIOLET, "Color not available!");
    }
    SendClientMessage(playerid,C_VIOLET,"You are not an admin");
    return 1;
}
The player will first have to do /rcon login to use this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)