21.08.2011, 00:30
I want to make an /enter command that makes it so that when you /enter your vehicles goes with you.
There is SetPlayerPos and also SetVehiclePos ..
Check if the player is in vehicle, If yes, then use SetVehiclePos to teleport, else , use SetPlayerPos to teleport.. |
new V;
public OnGameModeInit();
{
V = CreateVehicle(411, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext)
{
if(strcmp("/enter", cmdtext, true))
{
if(IsPlayerInAnyVehicle(playerid)) return Ban(playerid);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
SetVehiclePos(V, X,Y,Z);
PutPlayerInVehicle(playerid, V);
return 1;
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext)
{
if(strcmp("/enter", cmdtext, true, 6))
{
if(cmdtext[6])return SendClientMessage(playerid, 0xFFFF00, "Usage /enter [Carid]");
if(IsPlayerInAnyVehicle(playerid)) return Ban(playerid);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
SetVehiclePos(cmdtext[7], X,Y,Z);
PutPlayerInVehicle(playerid, cmdtext[7]);
return 1;
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext)
{
if(strcmp("/enter", cmdtext, true, 6))
{
if(!cmdtext[6])return SendClientMessage(playerid, 0xFFFF00, "Usage /enter [Carid]");
if(IsPlayerInAnyVehicle(playerid)) return Ban(playerid);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
SetVehiclePos(cmdtext[7], X,Y,Z);
PutPlayerInVehicle(playerid, cmdtext[7]);
return 1;
}
return 0;
}