How to teleport back to lobby inside a car? -
P3DRO - 15.03.2013
I made a derby cmd that teleports me to my derby arena inside a car ready to wreck everyone, however when i use my lobby cmd, that should teleport me back to my lobby, it gets buggy and teleports me to groove street instead -.-
I have death and leaving conditions when you are in the derby, in case you leave the car or died you will be "readded" to the derby.
I found what is bugging my gm, the bug only occurs when i use the cmd inside the car, i commented the "leave the car condition" and left the car and used /lobby and everything worked, but you are not suppose to have to leave the car to use /lobby, so I tried using removeplayerfromvehicle before using /lobby and added a flag not to readd me once i "leave" the car with the remove function, but it keeps bugging.
So my question is, how can i teleport back to my lobby inside a car without having to leave it first manually?
Re: How to teleport back to lobby inside a car? -
Misiur - 15.03.2013
Code please
Re: How to teleport back to lobby inside a car? -
P3DRO - 15.03.2013
i think this is all the code relative to this issue.
Код:
public OnPlayerConnect(playerid) {
Players[playerid][Derby] = false;
Players[playerid][DerbyRespawn] = false;
return 1; }
public OnPlayerSpawn(playerid) {
if (Players[playerid][DerbyRespawn]) { Players[playerid][DerbyRespawn] = false; Derby_Spawn(playerid); }
SetPlayerInterior(playerid, 0);
SetPlayerTeam(playerid, playerid);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerSkin(playerid, Players[playerid][Skin]);
SetPlayerColor(playerid, Color);
SetPlayerWorldBounds(playerid, 99999.0, -99999.0, 99999.0,- 99999.0);
SetPlayerPos(playerid, MainSpawn[0][0], MainSpawn[0][1], MainSpawn[0][2]);
return 1; }
public OnPlayerDeath(playerid, killerid, reason) {
SendDeathMessage(killerid, playerid, reason);
if (Players[playerid][Derby]) {
Players[playerid][DerbyRespawn] = true;
Players[playerid][Derby] = false; }
return 1; }
public OnPlayerStateChange(playerid, newstate, oldstate) {
if(newstate == PLAYER_STATE_DRIVER) { ... }
else {
// Derby
if (Players[playerid][Derby]) Derby_Spawn(playerid); }
return 1; }
dcmd_derby (playerid, params[]) {
#pragma unused params
if (Players[playerid][Derby]) return SendClientMessage(playerid, ERROR_COLOR, "ERROR MESSAGE");
format(cmdstr, 150, ">> %s has joined the Derby", Players[playerid][Name]);
SendClientMessageToAll(DERBY_COLOR, cmdstr);
Derby_Spawn(playerid);
return 1; }
dcmd_lobby (playerid, params[]) {
#pragma unused params
if (!Players[playerid][Derby]) return SendClientMessage(playerid, ERROR_COLOR, "ERROR MESSAGE");
format(cmdstr, 150, ">> %s has left the Derby", Players[playerid][Name]);
SendClientMessageToAll(DERBY_COLOR, cmdstr); }
if (IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
Players[playerid][Derby] = false;
SpawnPlayer(playerid);
return 1; }
Derby_Spawn (playerid) {
SetPlayerInterior(playerid, 0);
SetPlayerTeam(playerid, playerid);
SetPlayerVirtualWorld(playerid, SLOTS + SLOTS);
Players[playerid][Derby] = true;
// Spawn
if (IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid);
new i = random(sizeof(DerbySpawns));
new Float:x = DerbySpawns[i][0] + random(10);
new Float:y = DerbySpawns[i][1] + random(10);
new Float:z = DerbySpawns[i][2];
SetPlayerPos(playerid, x, y, z);
new Color1 = random(126);
new Color2 = random(126);
new Car = CreateVehicle(DerbyCars[random(sizeof(DerbyCars))], x, y, z, 0, Color1, Color2, 999999999);
LinkVehicleToInterior(Car, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(Car, GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, Car, 0);
// Armour & Health
SetPlayerArmour(playerid, 0);
SetPlayerHealth(playerid, 100);
return 1; }
Re: How to teleport back to lobby inside a car? -
P3DRO - 17.03.2013
bump
Re: How to teleport back to lobby inside a car? -
kamzaf - 17.03.2013
pawn Код:
dcmd_lobby (playerid, params[])
{
#pragma unused params
if (!Players[playerid][Derby]) return SendClientMessage(playerid, ERROR_COLOR, "ERROR MESSAGE");
format(cmdstr, 150, ">> %s has left the Derby", Players[playerid][Name]);
SendClientMessageToAll(DERBY_COLOR, cmdstr); }
if(IsPlayerInAnyVehicle(playerid))
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
SetPlayerPos(playerid, x,y,z+3);
Players[playerid][Derby] = false;
SpawnPlayer(playerid);
}
else
{
Players[playerid][Derby] = false;
SpawnPlayer(playerid);
}
return 1;
}
Sometimes RemovePlayerFromVehicle doesn't work, and if it does it needs some time to take action.
Re: How to teleport back to lobby inside a car? -
P3DRO - 17.03.2013
@kamzaf THANK YOU SO FUCKING MUCH