Police Spawn.
#1

archive
Reply
#2

archive
Reply
#3

Код:
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
	{
	    new PlayerVehicle = GetVehicleFileID(GetPlayerVehicleID(playerid));
	    new ftext[20];
		if(Vehicles[PlayerVehicle][Faction] != 0 && Vehicles[PlayerVehicle][Faction] != PlayerInfo[playerid][pMember])
		{
		    if(Vehicles[PlayerVehicle][Faction] == 1) { ftext = "LSPD"; }
			else if(Vehicles[PlayerVehicle][Faction] == 2) { ftext = "FBI"; }
			else if(Vehicles[PlayerVehicle][Faction] == 3) { ftext = "RCSD"; }
			else if(Vehicles[PlayerVehicle][Faction] == 4) { ftext = "LSFMD"; }
			else if(Vehicles[PlayerVehicle][Faction] == 5) { ftext = "National Guards"; }
			else if(Vehicles[PlayerVehicle][Faction] == 6) { ftext = "Senate"; }
			else if(Vehicles[PlayerVehicle][Faction] == 7) { ftext = "Secret Service"; }
			else if(Vehicles[PlayerVehicle][Faction] == 8) { ftext = "Hitman Agency"; }
			else if(Vehicles[PlayerVehicle][Faction] == 9) { ftext = "News Agency"; }
			else if(Vehicles[PlayerVehicle][Faction] == 10) { ftext = "Taxi Cab Company"; }
		    format( string, sizeof( string ), "This vehicle is only usable by {FF6347}%s{AFAFAF}.", ftext);
		    SendClientMessage( playerid, COLOR_GREY, string);
		    RemovePlayerFromVehicle(playerid);
		}
	}
Reply
#4

archive
Reply
#5

pawn Код:
if(strcmp(cmdtext,"/policespawn",true) ==0 )
    {
        if(IsPlayerInRangeOfPoint(playerid,5,1573.9717,-1696.8590,6.2188))
        {
         if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1) // assuming your LSPD Faction is id 1
        {
            ShowPlayerDialog(playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST,"Vehicles","LSPD Cruiser\nSFPD Cruiser\nLVPD Cruiser\nRancher\nSWAT Tank\nEnforcer\nFBI Truck","Spawn","Exit");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not a member of the LSPD.");
            return 1;
        }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not at the vehicle spawn checkpoint.");
            return 1;
        }
    }
you mean something like that?

ps not testing just quickly written on my ipad so please test

pps. wrong section next time post for scripting help here:

http://forum.sa-mp.com/forumdisplay.php?f=12
Reply
#6

Quote:
Originally Posted by ZaakWest
Посмотреть сообщение
Код:
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
	{
	    new PlayerVehicle = GetVehicleFileID(GetPlayerVehicleID(playerid));
	    new ftext[20];
		if(Vehicles[PlayerVehicle][Faction] != 0 && Vehicles[PlayerVehicle][Faction] != PlayerInfo[playerid][pMember])
		{
		    if(Vehicles[PlayerVehicle][Faction] == 1) { ftext = "LSPD"; }
			else if(Vehicles[PlayerVehicle][Faction] == 2) { ftext = "FBI"; }
			else if(Vehicles[PlayerVehicle][Faction] == 3) { ftext = "RCSD"; }
			else if(Vehicles[PlayerVehicle][Faction] == 4) { ftext = "LSFMD"; }
			else if(Vehicles[PlayerVehicle][Faction] == 5) { ftext = "National Guards"; }
			else if(Vehicles[PlayerVehicle][Faction] == 6) { ftext = "Senate"; }
			else if(Vehicles[PlayerVehicle][Faction] == 7) { ftext = "Secret Service"; }
			else if(Vehicles[PlayerVehicle][Faction] == 8) { ftext = "Hitman Agency"; }
			else if(Vehicles[PlayerVehicle][Faction] == 9) { ftext = "News Agency"; }
			else if(Vehicles[PlayerVehicle][Faction] == 10) { ftext = "Taxi Cab Company"; }
		    format( string, sizeof( string ), "This vehicle is only usable by {FF6347}%s{AFAFAF}.", ftext);
		    SendClientMessage( playerid, COLOR_GREY, string);
		    RemovePlayerFromVehicle(playerid);
		}
	}
this is not what he asked for...

This is if the player gets in the vehicle it says that it is only usable by (Faction Name) and removes them from the vehicle. He wants to make the cmd only for LSPD Faction Members/Leaders. Plus this code it taken from United Roleplay's GM Release.... Please read what the person is asking next time, before you answer.
Reply
#7

Well, firstly you need to define the actual team, which you can do if you're actually the scripter there, then all you do is:

pawn Код:
if(strcmp(cmd, "/policespawn", true) == 0)
 {
    if(IsPlayerInRangeOfPoint(playerid, 5,1573.9717,-1696.8590,6.2188))
    {
        if(playerInfo[playerid][pTeam] == 1) // assign the value to your desired team
        {
            ShowPlayerDialog(playerid, 8437, DIALOG_STYLE_LIST, "LSPD Vehicles", "LVPD\nLSPD\nSFPD\nMaverick\nRanger\nFBI", "Choose", "Exit");
        }
        else return SendClientMessage(playerid, -1, "You are not in the LSPD!");
    }
 }
 
 // put this somewhere in OnDialogResponse
 
 if(dialogid == 8437)
 {
    if(!reponse) return SendClientMessage(playerid, -1, "You cancelled selection."); // if he pressed escape/exit
    if(response) // if he clicked get car
    {
        // in here you add the code for spawning the vehicle, make sure it's about 5 away from them so they dont get stuck!
    }
 }
Reply
#8

Check using police skin ID if you don't have police think (for example. PlayerInfo[playerid][LSPDRank])
Reply
#9

archive
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)