26.03.2013, 22:00
So I need a command that will allow me to enter a RC car with a command like /rc and it will put me into the RC car.
new RC[MAX_PLAYERS]; // At top
if (strcmp("/RC", cmdtext, true, 10) == 0)
{
if(RC[playerid] == 0)
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
PutPlayerInVehicle(playerid, RCCAR, 0);
SendClientMessage(playerid, -1, "You are now in a RC car, type /rc again to exit it.");
RC[playerid] = 1;
return 1;
}
else if(RC[playerid] == 1)
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
DestroyVehicle(RCCAR);
SendClientMessage(playerid, -1, "You exited the RC car!");
RC[playerid] = 0;
return 1;
}
return 1;
}
CMD:RC(playerid, params[])
{
if(RC[playerid] == 0)
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
PutPlayerInVehicle(playerid, RCCAR, 0);
SendClientMessage(playerid, -1, "You are now in a RC car, type /rc again to exit it.");
RC[playerid] = 1;
return 1;
}
else if(RC[playerid] == 1)
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
DestroyVehicle(RCCAR);
SendClientMessage(playerid, -1, "You exited the RC car!");
RC[playerid] = 0;
return 1;
}
return 1;
}
CMD:RC(playerid, params[])
{
if(RC[playerid] == 0)
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
PutPlayerInVehicle(playerid, RCCAR, 0);
SendClientMessage(playerid, -1, "You are now in a RC car, type /rc again to exit it.");
RC[playerid] = 1;
return 1;
}
else if(RC[playerid] == 1)
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
PutPlayerInVehicle(playerid, RCCAR, 0);
DestroyVehicle(RCCAR);
SendClientMessage(playerid, -1, "You exited the RC car!");
RC[playerid] = 0;
}
return 1;
}