Quote:
Originally Posted by Speed
i have problem with /goto
pawn Код:
CMD:goto(playerid, params[]) { new id, car; if(sscanf(params, "u", id))return Use(playerid, "/goto [name/ID]"); else if(PlayerInfo[playerid][pAdmin] < 1)return SendAdmin(playerid, "Not admin!"); new Float:x, Float:y, Float:z; GetPlayerPos(id, x, y, z); SetPlayerPos(playerid, x+1, y, z); if(IsPlayerInVehicle(playerid, car)) { SetVehiclePos(car, x, y, z); PutPlayerInVehicle(playerid, car, 0); } SendClientMessage(playerid, Grey, "Teleport."); return 1; }
i can port with car, pls help.. how to port with a car to person?
|
Car is not assigned a value yet, so it's 0.. therefore it won't work. However you can save time and effort by simply adding IsPlayerInAnyVehicle function.
pawn Код:
CMD:goto(playerid, params[])
{
new id;
if(sscanf(params, "u", id))return Use(playerid, "/goto [name/ID]");
else if(PlayerInfo[playerid][pAdmin] < 1)return SendAdmin(playerid, "Not admin!");
new Float:x, Float:y, Float:z;
GetPlayerPos(id, x, y, z);
SetPlayerPos(playerid, x+1, y, z);
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
}
SendClientMessage(playerid, Grey, "Teleport.");
return 1;
}