24.02.2009, 16:13
Hello ppl. I'm trying to make a command with what player spawns a car. But I need so skin ID 23 spawns a car with ID 457 and so on. How to check what skin ID player has? And how to put it in a command?
if(!strcmp("/spawncar", cmdtext, true))
{
new skin;
skin = GetPlayerSkin(playerid);
if(skin == 23)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
CreateVehicle(457,x,y-4,z,a,0,1,99999) // 99999 - car respawn delay
}
else
{
SendClientMessage(playerid,0x0080FFFF,"You must have skin id 23 to use this command");
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
if (strcmp(cmdtext, "/car", true)==0) { new Float:X, Float:Y, Float:Z, Float:Angle; if(Start != 1) { return SendClientMessage(playerid, COLOR_GREY, "blah blah blah"); } GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, Angle); if(Carer[playerid] == 1) { if(IsAnyPlayerInVehicle(Veh[playerid])) { for(new i=0; i<GetMaxPlayers(); i++) { if(GetPlayerVehicleID(i) == Veh[playerid]) { RemovePlayerFromVehicle(i); } } } PutPlayerInVehicle(playerid, Veh[playerid], 0); SetVehiclePos(Veh[playerid], X, Y, Z); SetVehicleZAngle(Veh[playerid], Angle); } else { Carer[playerid] = 1; skin = GetPlayerSkin(playerid); if(skin == 283){ Veh[playerid] = CreateVehicle(599, X, Y, Z+50, Angle, 0, 0, 10000); } else if(skin == 165){ Veh[playerid] = CreateVehicle(490, X, Y, Z+50, Angle, 0, 0, 10000); } else if(skin == 285){ Veh[playerid] = CreateVehicle(528, X, Y, Z+50, Angle, 0, 0, 10000); } else if(skin == 282){ Veh[playerid] = CreateVehicle(598, X, Y, Z+50, Angle, 0, 0, 10000); } else if(skin == 280){ Veh[playerid] = CreateVehicle(596, X, Y, Z+50, Angle, 0, 0, 10000); } else if(skin == 281){ Veh[playerid] = CreateVehicle(597, X, Y, Z+50, Angle, 0, 0, 10000); } PutPlayerInVehicle(playerid, Veh[playerid], 0); SetVehiclePos(Veh[playerid], X, Y, Z); SetVehicleZAngle(Veh[playerid], Angle); return 1; } } return 0; }