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



admin - viosteaua98 - 24.11.2011

i need help
so: i want do all huntleys can be drived just by admin [rcon] a
and Mafia Boss Skin can be used just by admin [rcon]
when i logged in rcon all cars will not take damage for me


Re: admin - Max_Coldheart - 24.11.2011

pawn Код:
OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        if(vehicleid == 579)
        {
            if(!IsPlayerAdmin(playerid)
            {
                  SendClientMessage(playerid, -1, "Huntley can be driven only by admin.");
                  ClearAnimations(playerid);
                  return 1;
             }
        }
    }
}



Re: admin - viosteaua98 - 24.11.2011

all cars drived by admins [rcon] will have infinty health 1000 everytime i want say
and mafia boss just for admin
mafia boss skin


Re: admin - Kingunit - 24.11.2011

Quote:
Originally Posted by Max_Coldheart
Посмотреть сообщение
pawn Код:
OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        if(vehicleid == 579)
        {
            if(!IsPlayerAdmin(playerid)
            {
                  SendClientMessage(playerid, -1, "Huntley can be driven only by admin.");
                  ClearAnimations(playerid);
                  return 1;
             }
        }
    }
}
You forget the else with RemovePlayerFromVehicle.


Re: admin - Max_Coldheart - 24.11.2011

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
You forget the else with RemovePlayerFromVehicle.
RemovePlayerFromVehicle wouldn't work in this callback, as this is called right away when player presses enter near a vehicle (at least it used to be called then), so you have to clear the entering animation, and the player can't enter.


Re: admin - viosteaua98 - 24.11.2011

i get errors
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        if(vehicleid == 579)
        {
            if(!IsPlayerAdmin(playerid)
            {
                  SendClientMessage(playerid, -1, "Huntley can be driven only by admin.");
                  ClearAnimations(playerid);
                  return 1;
            }
        }
   }
}
pawn Код:
C:\Users\Vio\Desktop\nothing.pwn(106) : error 001: expected token: ")", but found "{"
C:\Users\Vio\Desktop\nothing.pwn(113) : warning 209: function "OnPlayerEnterVehicle" should return a value
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: admin - Max_Coldheart - 24.11.2011

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(ispassenger == 0)
    {
        if(vehicleid == 579)
        {
            if(!IsPlayerAdmin(playerid)
            {
                  SendClientMessage(playerid, -1, "Huntley can be driven only by admin.");
                  ClearAnimations(playerid);
            }
        }
   }
   return 1;
}



Re: admin - viosteaua98 - 24.11.2011

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger == 0)
    {
        if(vehicleid == 579)
        {
            if(!IsPlayerAdmin(playerid)
            {
                  SendClientMessage(playerid, -1, "Huntley can be driven only by admin.");
                  ClearAnimations(playerid);
            }
        }
    }
    return 1;
}
pawn Код:
C:\Users\Vio\Desktop\nothing.pwn(101) : warning 213: tag mismatch
C:\Users\Vio\Desktop\nothing.pwn(106) : error 001: expected token: ")", but found "{"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: admin - Kingunit - 24.11.2011

Quote:
Originally Posted by Max_Coldheart
Посмотреть сообщение
RemovePlayerFromVehicle wouldn't work in this callback, as this is called right away when player presses enter near a vehicle (at least it used to be called then), so you have to clear the entering animation, and the player can't enter.
Then you can better use OnPlayerKeyStateChange


Re: admin - Max_Coldheart - 24.11.2011

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
Then you can better use OnPlayerKeyStateChange
Yes, but I don't know how to actually use that (I'm not pretty good in that area), so I dislike using it