Spawn car for skin
#1

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?
Reply
#2

pawn Код:
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;
            }
Under
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
Reply
#3

Ok, this is my command. In my script skins are given in random so if player dies and spawns with new skin, he gets the car what he had spawned first. How can I make it so when player spawns again the last spawned car disapears and creates new one? I hope you will understand what I ment.
Код:
	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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)