[HELP]TPing Vehicle ID to me! -
Cjgogo - 26.05.2013
OK, so I have a problem, as an admin(while on foot), I want to be able to teleport a specific vehicle ID to me, using this command:
pawn Код:
COMMAND:tveh(playerid,params[])
{
if(GetPVarInt(playerid,"Adminlevel")<1) return SendClientMessage(playerid,COLOR_RED,"This command is only for admins");
else
{
new vehicleid;
if(sscanf(params,"u",vehicleid)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/tveh [ID]");
if(!IsValidVehicle(vehicleid)) return SendClientMessage(playerid,COLOR_RED,"Invalid vehicle ID!");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetVehiclePos(vehicleid,x+1,y,z);
SendClientMessage(playerid,COLOR_GREEN,"You have succesfully teleported the vehicle to you!");
}
return 1;
}
To see the vehicle's ID, I do /dl ofc, but what happens is that the command will always say "Invalid vehicle ID", no matter what vehicle ID I insert, so, I don't see the problem. Help, please.
AW: [HELP]TPing Vehicle ID to me! -
Skimmer - 26.05.2013
pawn Код:
COMMAND:tveh(playerid,params[])
{
if(GetPVarInt(playerid,"Adminlevel")<1) return SendClientMessage(playerid,COLOR_RED,"This command is only for admins");
new vehicleid;
if(sscanf(params,"d",vehicleid)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/tveh [ID]");
if(!IsValidVehicle(vehicleid)) return SendClientMessage(playerid,COLOR_RED,"Invalid vehicle ID!");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetVehiclePos(vehicleid,x+1,y,z);
SendClientMessage(playerid,COLOR_GREEN,"You have succesfully teleported the vehicle to you!");
return 1;
}
Try this?
Re: [HELP]TPing Vehicle ID to me! -
Rock - 26.05.2013
pawn Код:
if(sscanf(params,"u",vehicleid))
Specifier "u" is for playerid ONLY, instead of that use "i" which comes from 'integer', that's what you need.
EDIT:
Too late..
Re: [HELP]TPing Vehicle ID to me! -
Cjgogo - 26.05.2013
Thank you both very much, it worked with "d" and "i" instead of "u", should have payed more attention, thanks

.