Vehicle putplayinvehicle
#1

When i spawn the vehicle it didnt not put me into the vehicle i get this warning


Код:
warning 202: number of arguments does not match definition
PHP код:
}
COMMAND:veh(playeridparams[])
{
    new 
iVehicleiColors[2], Float:Poz[4];
    if(
sscanf(params"iii"iVehicleiColors[0], iColors[1]))
        return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /veh [model ID] [color 1] [color 2]");
    if(!(
400 <= iVehicle <= 611))
        return 
SendClientMessage(playeridCOLOR_LIGHTRED"ERROR: Invalid model specified (model IDs start at 400, and end at 611).");
    if(!(
<= iColors[0] <= 255 && <= iColors[1] <= 255))
        return 
SendClientMessage(playeridCOLOR_LIGHTRED"ERROR: Invalid colour specified (IDs start at 0, and end at 255).");
    if (
GetPVarInt(playerid"PlayerLogged") == 0) return SendClientMessage(playeridCOLOR_WHITE"You must be logged in to use this.");
    if(!
AdminUser(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to create a admin user, /admincreate.");
    if(
GetPVarInt(playerid"AdminLogged") == 0) return SendClientMessage(playeridCOLOR_GREY"You need to login into your admin account, /adminlogin.");
    if(
GetPVarInt(playerid"Admin") < 2)
    {
        
GetPlayerPos(playeridPoz[0], Poz[1], Poz[2]); //getting player pos
        
GetPlayerFacingAngle(playeridPoz[3]); //getting player angle
        
CreateVehicle(strval(params), Poz[0]+4Poz[1], Poz[2], Poz[3], 00, -1); //creating vehicle
        
PutPlayerInVehicle(playerid0); //Puting player in vehicle as dirver
    
}
    else
    {
         
SendClientMessage(playeridCOLOR_LIGHTRED"SERVER: You do not have access to this command!");
    }
    return 
1
Reply
#2

PutPlayerInVehicle requires the playerid, the vehicle id and the seat id.

So

Save the ID of the created veh like
new cveh = CreateVehicle(blablablblala);
PutPlayerInVehicle(playerid, cveh, 0);
Reply
#3

I'm puzzled as to why you use strval(params), which includes the entire parameter string by the way, instead of the iVehicle you retrieved earlier.

Is that warning even from this piece of code? Edit: and I'm not paying attention because apparently it is.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
I'm puzzled as to why you use strval(params), which includes the entire parameter string by the way, instead of the iVehicle you retrieved earlier.

Is that warning even from this piece of code?
This line

Код:
PutPlayerInVehicle(playerid, 0);
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
I'm puzzled as to why you use strval(params), which includes the entire parameter string by the way, instead of the iVehicle you retrieved earlier.

Is that warning even from this piece of code? Edit: and I'm not paying attention because apparently it is.
I am pretty sure it is since PutPlayerInVehicle requires 3 parameter, still, I also noticed what you are talking about but I didn't bothered on actually typing it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)