[Question] /setfaction
#1

Ok so I made some factions for my RP server ... bla bla bla ... but I got a problem with the /setfaction command ... to be honest I got no ideea how to make it cuz (maybe I'm too tierd) is like a puzzle for me. I'm using gTeam so I want a command like /setfaction [playerid] [factionid/faction name] ... could anyone give me the script (I'm not the copy,paste type ... I req the scripts just to learn from them ... is much easier for me to learn from the raw code than from explanations). Thx, if you need any piece of code from my GM tell me.


[I ******d for tuts and also tryed to get some raw codes from RP gamemodes but today I'm not lucky]
Reply
#2

Okayy soo tell us what factions do you have?

EDIT: It'll be something like that
for example

pawn Код:
dcmd_makelvpd(playerid,params[])
{
    new string[128];
    new ID;
    new tname[MAX_PLAYER_NAME];
    if(sscanf(params,"us[100]",ID))
    {
        SendClientMessage(playerid,COLOR_ERROR,"[USAGE] /makelvpd (Player Name/ID)");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"[ERROR] The player ID you entered is not connected to the server.");
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    GetPlayerName(ID,tname,sizeof(tname));
    if(PlayerInfo[ID][pLVPD] == 1)
    {
        format(string,sizeof(string),"[ERROR] %s(%d) is already in the LVPD Faction.",tname,ID);
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    PlayerInfo[ID][pLVPD] =1;
    SendClientMessage(ID,COLOR_PINK,"[PROMOTE] You have been promoted to be in LVPD Faction.");
    return 1;
}
Reply
#3

pawn Код:
#define Middler 5 //Civil
#define Havoc 6 // Havoc
#define Safe 7 //Strategic Action For Emergencies
Reply
#4

it's simple:

Код:
YCMD:setfaction(playerid, params[], help)
{
    if (help) return SendClientMessage(playerid, 0x808080FF, "/setfaction is used to set a users Faction.");
	new id,team;
	if(sscanf(params,"dd",id,team)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /setfaction [Player-ID] [Faction-ID]");
	if(gTeam[id] == team) return SendClientMessage(playerid,0xFF0000FF,"The Player already is a member of this Faction!");
	gTeam[id] = team;
	SendClientMessage(playerid,-1,"You've set the Faction of this Player successfully.");
    return 1;
}
now "/setfaction 0 5" would make the player with the id "0", a member of the faction wich has the id 5, wich in our case is the "Middler" faction
Reply
#5

Thank you guys, You are the best +Rep for both


Tested: WORKING ... I'll just change a few things + thank you for the "usage" thing CutX ... I'll add you to the Credits
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)