SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/01/2015, 09:32 PM   #1
lulo356
Gangsta
 
Join Date: Jun 2013
Posts: 501
Reputation: 4
Default CMD:hire doesnt work prob.

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;
}
__________________

lulo356 is offline   Reply With Quote
Old 12/01/2015, 09:08 AM   #2
lulo356
Gangsta
 
Join Date: Jun 2013
Posts: 501
Reputation: 4
Default Re: CMD:hire doesnt work prob.

Someome?
__________________

lulo356 is offline   Reply With Quote
Old 12/01/2015, 09:11 AM   #3
Rabea
Huge Clucker
 
Join Date: Jul 2014
Posts: 365
Reputation: 2
Default Re: CMD:hire doesnt work prob.

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
__________________
My works:
[Tutorial] Mask system for RP servers
[Tutorial] Armory/looadarmory for RP servers
Rabea is offline   Reply With Quote
Old 12/01/2015, 09:14 AM   #4
HazardouS
Huge Clucker
 
HazardouS's Avatar
 
Join Date: Aug 2014
Posts: 255
Reputation: 26
Default Re: CMD:hire doesnt work prob.

pawn Code:
new idx = Faction[playerb];
Isn't idx 0 all the time? I mean ... playerb is civilian, right?

pawn Code:
Faction[playerid] = 0;
Isn't this supposed to keep its value? Playerid is the leader, so he is not leaving his faction.
HazardouS is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Doesnt work.. HK Scripting Help 1 30/11/2013 06:44 PM
SplitText doesnt work + Object doesnt attach KfirRP Help Archive 6 04/08/2011 01:42 AM
function doesnt work as i want it to work. legodude Help Archive 0 14/03/2011 02:25 PM
Why doesnt this work? BigAl Help Archive 1 27/10/2010 06:51 PM
Why doesnt this work? BigAl Help Archive 1 27/10/2010 06:38 PM


All times are GMT. The time now is 07:23 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.