CMD:hire doesnt work prob. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD:hire doesnt work prob. (
/showthread.php?tid=556860)
CMD:hire doesnt work prob. -
lulo356 - 11.01.2015
I created an /hire for the fation leaders but it doenst set the players faction when they did /hire And i don't see the problem.
pawn Code:
CMD:hire(playerid, params[])
{
new playerb, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /hire [playerid]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(PlayerInfo[playerb][pFac]) return SendClientMessage(playerid, COLOR_GREY, "Player is already in a faction.");
if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't invite yourself.");
new idx = Faction[playerb];
PlayerInfo[playerb][pFac] = Faction[playerid];
PlayerInfo[playerb][pFacRank] = 0;
FacInfo[idx][facMembers] ++;
PlayerInfo[playerb][pFacLeader] = 0;
PlayerInfo[playerb][pFacDiv] = 0;
PlayerInfo[playerb][pFacDivLeader] = 0;
Faction[playerid] = 0;
format(string, sizeof(string), " You hired %s in the faction %s.", RPN(playerb), RPFNEx(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s has hired you in the %s", RPN(playerid), RPFNEx(playerid));
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
return 1;
}
Re: CMD:hire doesnt work prob. -
lulo356 - 12.01.2015
Someome?
Re: CMD:hire doesnt work prob. -
Rabea - 12.01.2015
pawn Code:
CMD:hire(playerid, params[])
{
new playerb, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /hire [playerid]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(PlayerInfo[playerb][pFac]) return SendClientMessage(playerid, COLOR_GREY, "Player is already in a faction.");
if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't invite yourself.");
new idx = Faction[playerb];
FacInfo[idx][facMembers] ++;
PlayerInfo[playerb][pFac] = Faction[playerid];
/* PlayerInfo[playerb][pFacRank] = 0;
FacInfo[idx][facMembers] ++;
PlayerInfo[playerb][pFacLeader] = 0;
PlayerInfo[playerb][pFacDiv] = 0;
PlayerInfo[playerb][pFacDivLeader] = 0;
Faction[playerid] = 0;*/
format(string, sizeof(string), " You hired %s in the faction %s.", RPN(playerb), RPFNEx(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s has hired you in the %s", RPN(playerid), RPFNEx(playerid));
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
return 1;
}
Try this
Re: CMD:hire doesnt work prob. -
HazardouS - 12.01.2015
pawn Code:
new idx = Faction[playerb];
Isn't idx 0 all the time? I mean ... playerb is civilian, right?
Isn't this supposed to keep its value? Playerid is the leader, so he is not leaving his faction.