Spawn Factions ! ( +REP all for help )
#1

Hello all
Today i met a problem and i think r will help me ! Please
I make a factions : commands . But I do not know how to make a Spawn Factions
e.g : LSPD spawn 1554.7692,-1676.1294,16.1953 and so on.
I give a + REP , all peolpe ,who help me!

There is my code:
Enum:
Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pSex,
    pAge,
	pSkin,
	pTeam,
	pAccent,
	pTaxiLic,
	Leader,
	Member,
	Rank

}
new PlayerInfo[MAX_PLAYERS][pInfo];
And This is Commands:
CMD:makeleader:
Код:
CMD:makeleader(playerid, params[])
{
    new targetid, factionid, string[128], targetname[24], playername[24];
    if(sscanf(params, "ui", targetid, factionid)) return SendClientMessage(playerid, -1, "Usage: /makeleader [playerid][factionid]"); //Checks if they typed in anything for the playerid and factionid parameters, and if they don't, return a client message.
    if(PlayerInfo[playerid][pAdmin] != 4) return SendClientMessage(playerid, -1, "You are not an admin"); //Checks if they are an admin.  Remember, change this to your admin variable, or use !IsPlayerAdmin to check if they aren't rcon admin.
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Invalid playerid!"); //Sends a message if the player is not connected
    if(0 < factionid < 7) 
    {
        GetPlayerName(playerid, playername, sizeof(playername)); //Gets the players name and saves it to the variable playername
        GetPlayerName(targetid, targetname, sizeof(targetname)); //Gets the targets name and saves it to the variable targetname
        format(string, sizeof(string), "You made %s leader of faction id %i!", targetname, factionid); //Formats the string that you will receive
        SendClientMessage(playerid, -1, string); //Sends a message to the person who changes the other persons faction in a random color
        format(string, sizeof(string), "You were made leader of faction id %i by %s", factionid, playername);//Formats the string that the player will receive
        SendClientMessage(playerid, -1, string); //Sends a message to the person who is made the faction leader
        PlayerInfo[playerid][Leader] = factionid;
        PlayerInfo[playerid][Rank] = 6;
		PlayerInfo[playerid][Member] = factionid;
    }
    else return SendClientMessage(playerid, -1, "Invalid factionid.  Factionid's: 1,2,3,4,5,6");
    return 1;
}
CMD:fpk:
Код:
CMD:fpk(playerid, params[])
{
    new targetid, targetname[24], playername[24], string[128]; 
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /fpk [playerid/partofname]"); //Sends message if they do not type something in for the targetid/name
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Invalid playerid!"); //Sends a message if the player isn't connected
    if(PlayerInfo[playerid][pAdmin] != 4 && PlayerInfo[playerid][Rank] != 6) return SendClientMessage(playerid, -1, "You are not a high enough admin or you aren't the leader!"); //Sends a message if they aren't the leader of the faction and if they aren't admin
    GetPlayerName(targetid, targetname, sizeof(targetname)); //Stores the targetid's name in the targetname variable
    GetPlayerName(playerid, playername, sizeof(playername)); //Stores the playerid's name in the playername variable
    format(string, sizeof(string), "You removed %s from his (now) previous faction!", targetname);//Formats the message that will be sent to you (the player)
    SendClientMessage(playerid, -1, string);//Sends the message that is formatted above to the playerid in a random color
    format(string, sizeof(string), "You were removed from your faction by %s!", playername);
    SendClientMessage(targetid, -1, string);
    PlayerInfo[targetid][Leader] = 0;
    PlayerInfo[targetid][Rank] = 0;
    PlayerInfo[targetid][Member] = 0;
    return 1; 
}
Please show me how and where put a spawn factions !
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][Leader] == 1 || PlayerInfo[playerid][Member] == 1) // Assuming Faction 1 is LSPD.
    {
        SetPlayerPos(playerid,1554.7692,-1676.1294,16.1953);
        SendClientMessage(playerid,"You've spawned as an LSPD member.");
    }
    else if(PlayerInfo[playerid][Leader] == 2 || PlayerInfo[playerid][Member] == 2)
    {
        //SetPlayerPos(playerid,x,y,z);

    }
    // and so on.
}
Reply
#3

DaniceMcHarley === Working ! Thanks very much +REP for you . And tomorrow I will give +REP because i ask more people and no one answer me ! Thanks very much
Reply
#4

You're welcome.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)