Getcar problem - 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: Getcar problem (
/showthread.php?tid=435377)
Getcar problem -
Squirrel - 06.05.2013
My /getcar doesnt work. No errors on compile
pawn Код:
CMD:getcar(playerid, params[])
{
new carid;
if(PlayerInfo[playerid][pAdminLevel] >= 3)
{
if(sscanf(params, "i", carid)) return SendClientMessage(playerid, ~1, "USAGE: /getcar [carid]");
if(carid > MAX_VEHICLES) return SendClientMessage(playerid, ~1, "That vehicle does not exists.");
new Float: gPos[3];
GetPlayerPos(playerid, gPos[0], gPos[1], gPos[2]);
SetVehiclePos(carid, gPos[0] + 2, gPos[1], gPos[2]);
}
return 1;
}
Re: Getcar problem -
DobbysGamertag - 06.05.2013
Try this:
pawn Код:
CMD:getcar(playerid,params[])
{
//admin check
{
if(!strlen(params)) return
SendClientMessage(playerid, -1, "Usage: /vget [VehicleID]") &&
SendClientMessage(playerid,-1, "Function: Will Bring the specified Vehicle to your Position");
new player1;
new string[128];
player1 = strval(params);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
SetVehiclePos(player1,x+3,y,z);
SetVehicleVirtualWorld(player1,GetPlayerVirtualWorld(playerid));
format(string,sizeof(string),"You brought the Vehicle ID '%d' to your Position", player1);
return SendClientMessage(playerid,-1,string);
}
//else return //you can tell em its not a player command
}
AW: Getcar problem -
Squirrel - 06.05.2013
Yeah but that's without sscanf.
Re: Getcar problem -
DobbysGamertag - 06.05.2013
Try this, it may seem the same, i just tested it myself. It works fine for me:
pawn Код:
CMD:getcar(playerid, params[])
{
new carid;
if(sscanf(params, "i", carid)) return SendClientMessage(playerid, ~1, "USAGE: /getcar [carid]");
if(carid > MAX_VEHICLES) return SendClientMessage(playerid, ~1, "That vehicle does not exists.");
new Float: gPos[3];
GetPlayerPos(playerid, gPos[0], gPos[1], gPos[2]);
SetVehiclePos(carid, gPos[0] + 2, gPos[1], gPos[2]);
return 1;
}
Re: Getcar problem -
Stanford - 06.05.2013
Try this:
pawn Код:
CMD:getcar(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
new carid;
if(sscanf(params, "d", carid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /getcar [carid]");
new Float:plocx,Float:plocy,Float:plocz;
GetPlayerPos(playerid, plocx, plocy, plocz);
SetVehiclePos(carid,plocx,plocy+4, plocz);
SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
}
return 1;
}
+REP if I helped!, I hope that I helped ya
AW: Getcar problem -
Squirrel - 06.05.2013
Ty VM +rep