Vehicle id getter
#1

Hey Everybody

I'm trying to make a vehicle id getter so i know in wich vehicle i am
(for spectating purposes)

I now have this

pawn Код:
#define FILTERSCRIPT

#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Vid", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            GetPlayerVehicleID(playerid);
            SendClientMessage(playerid,0x00FF00,"your vehicle id is: %");
        }
        else
        {
            SendClientMessage(playerid,0x0000FFFF,"You are not in a vehicle");
        }
        return 1;
    }
    return 0;
}
but its not working
it wanna know wich this line "your vehicle id is: %" has to be

Thanks in advance
Reply
#2

You could try this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Vid", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new string[80];
            GetPlayerVehicleID(playerid, string, sizeof(string));
            format(string,sizeof(string),"Your vehicle id is: %i", string);
            SendClientMessage(playerid, 0x00FF08FF, string);
        }
        else
        {
            SendClientMessage(playerid,0x0000FFFF,"You are not in a vehicle");
        }
        return 1;
    }
    return 0;
}
Not sure if it works.
Reply
#3

its better but now i get this errors
Код:
C:\Users\User\Desktop\files\sa-mp\own\filterscripts\vid getter.pwn(12) : warning 202: number of arguments does not match definition
C:\Users\User\Desktop\files\sa-mp\own\filterscripts\vid getter.pwn(12) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Vid", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new string[80];
            GetPlayerVehicleID(playerid, string, sizeof(string)); //this is line 12
            format(string,sizeof(string),"Your vehicle id is: %d", string);
            SendClientMessage(playerid, 0x00FF08FF, string);
        }
        else
        {
            SendClientMessage(playerid,0x0000FFFF,"You are not in a vehicle");
        }
        return 1;
    }
    return 0;
}
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Vid", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new string[24];
            format(string, 24, "Your vehicle id is:: %i");
            SendClientMessage(playerid, 0xFFFFFFFF, string);
        }
        else
        {
            SendClientMessage(playerid,0x0000FFFF,"You are not in a vehicle");
        }
        return 1;
    }
    return 0;
}
Maybe...
Reply
#5

not working
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Vid", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new string[24];
            format(string, 24, "Your vehicle id is:: %i");
            SendClientMessage(playerid, 0xFFFFFFFF, string);
        }
        else
        {
            SendClientMessage(playerid,0x0000FFFF,"You are not in a vehicle");
        }
        return 1;
    }
    return 0;
}
it says in every vehicle "Your vehicle id is:: 47"
Reply
#6

format(string, 24, "Your vehicle id is:: %d", GetPlayerVehicleID(playerid));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)