Vehicle ID's
#1

I need help like a command, /getvehicleid which shows the ID of the vehivle which the person is currently on

Also when you enter a vehicle, a client message will show up

Quote:

You entered [vehicle name and id].

Sorry if this is the wrong section
Reply
#2

pawn Код:
Public OnPlayerEnterVehicle(playerid,vehicleid)
{
    SendClientMessage(playerid,vehicleid);
Return 1;
}
Try this
Reply
#3

pawn Код:
CMD:vehid(playerid, params[])
{
    new string[16];
    format(string, sizeof string, "%d", GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, -1, string);
    return 1;
}
Reply
#4

Can there also be a command for admins to view others' vehicle iD?
Reply
#5

Yes, You can see in your samp server folders, In Vehicles
Reply
#6

You must have sscanf2 for this code to work also:

pawn Код:
CMD:avehid(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] > 0)
    {
        new targetid, string[16];
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /avehid [playerid/partofname]");
        {
            if(!IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, -1, "That player isn't in a vehicle!");
           
            format(string, sizeof string, "%d", GetPlayerVehicleID(targetid));
            SendClientMessage(playerid, -1, string);
        }
    }
    else return SendClientMessage(playerid, -1, "You must be an admin to use this command!");
    return 1;
}
Reply
#7

Oh, thanks dude. I am a newbie to scripting -.-

If I want to use it for Ladmin, I just have to edit
Код:
if(PlayerInfo[playerid][pAdmin] > 0)
to
Код:
if(PlayerInfo[playerid][Level] >= 4) {
Reply
#8

No, you don't need that unnecessary bracket in the end of the line, because a new bracket is already starting on the next line, just do it like this:
pawn Код:
if(PlayerInfo[playerid][Level] >= 4)
Reply
#9

K, ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)