if (strcmp("/spawn", cmdtext, true, 10) == 0) { SetPlayerPos(playerid,-50.0743,-274.4324,5.4297); // Do something here SetPlayerFacingAngle(playerid,180.0); SendClientMessage(playerid,0x00FF00FF,"You have teleported to the spawnpoint"); return 1;
if (strcmp("/spawn", cmdtext, true, 10) == 0) { new vehid; vehid = GetPlayerVehicleID(playerid); SetPlayerPos(playerid,2155.0159,942.3558,10.8203); SetVehiclePos(vehid, 2155.0159,942.3558,10.8203); PutPlayerInVehicle( playerid, vehid, 0); }
Do a check if they are in a vehicle or not and if they are, just teleport the vehicle. Otherwise, just teleport them. For the above code, you can just tele the vehicle and the player will remain.
|
if (strcmp("/spawn", cmdtext, true, 10) == 0) { if(IsPlayerInAnyVehicle(playerid)) { new Float:X; new Float:Y; new Float:Z; new VehicleID; GetPlayerPos(playerid, X, Y, Z); VehicleID = GetPlayerVehicleID(playerid); SetVehiclePos(VehicleID, -50.0743,-274.4324,5.4297); } else { new Float:X; new Float:Y; new Float:Z; GetPlayerPos(playerid, X, Y, Z); SetPlayerPos(playerid, -50.0743,-274.4324,5.4297); } return 1; }
Код:
if (strcmp("/spawn", cmdtext, true, 10) == 0) { if(IsPlayerInAnyVehicle(playerid)) { new Float:X; new Float:Y; new Float:Z; new VehicleID; GetPlayerPos(playerid, X, Y, Z); VehicleID = GetPlayerVehicleID(playerid); SetVehiclePos(VehicleID, -50.0743,-274.4324,5.4297); } else { new Float:X; new Float:Y; new Float:Z; GetPlayerPos(playerid, X, Y, Z); SetPlayerPos(playerid, -50.0743,-274.4324,5.4297); } return 1; } |
if (strcmp("/spawn", cmdtext, true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehiclePos(GetPlayerVehicleID(playerid), -50.0743,-274.4324,5.4297);
else SetPlayerPos(playerid, -50.0743,-274.4324,5.4297);
return 1;
}