16.05.2016, 11:17
Hello Sa-Mp again, I have a concerning about how to teleport myself in player's car if he is in a vehicle with cmd /goto
here is my command I tried to put PutPlayerInVehicle but I spoiled it.. sorry for giving you problems with my stupid commands
Here is my command GOTO.
Thank you very much bros
here is my command I tried to put PutPlayerInVehicle but I spoiled it.. sorry for giving you problems with my stupid commands
Here is my command GOTO.
Код:
CMD:goto(playerid, params[])
{
if(playerVariables[playerid][pAdminLevel] >= 1)
{
new userID;
new vehicleid = GetPlayerVehicleID(userID);
if(sscanf(params, "u", userID)) {
return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/goto [playerid]");
}
else {
if(!IsPlayerConnected(userID)) return SendClientMessage(playerid, COLOR_GREY, "The specified player ID is either not connected or has not authenticated.");
new messageString[64];
new Float: fPos[3];
GetPlayerPos(userID, fPos[0], fPos[1], fPos[2]);
if(IsPlayerInAnyVehicle(userID) && GetPlayerState(userID) == PLAYER_STATE_DRIVER)
{
LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(userID));
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(userID));
PutPlayerInVehicle(playerid, vehicleid, 1);
SetPlayerPos(playerid, fPos[0]+2, fPos[1], fPos[2]);
}
else
{
SetPlayerPos(playerid, fPos[0]+2, fPos[1], fPos[2]);
SetVehiclePos(GetPlayerVehicleID(playerid), fPos[0], fPos[1]+2, fPos[2]);
}
SetPlayerInterior(playerid, GetPlayerInterior(userID));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(userID));
GetPlayerName(userID, szPlayerName, MAX_PLAYER_NAME);
format(messageString, sizeof(messageString), "You have teleported to %s.", szPlayerName);
SendClientMessage(playerid, COLOR_WHITE, messageString);
IsOnDM[playerid] = IsOnDM[userID];
InBizz[playerid] = InBizz[userID];
InHouse[playerid] = InHouse[userID];
InHQ[playerid] = InHQ[userID];
}
}
return 1;
}


