19.02.2014, 20:53
Well i made factions but now i have problems with /finvite and /fkick that i made so basiclly when i do /finvite it auto adds the player without asking him if he accepts it or not
and /fkick command if you are in one faction and the other player is in another faction you can kick the player that is in a different faction
here is my code
/finvite
/fkick code
and /fkick command if you are in one faction and the other player is in another faction you can kick the player that is in a different faction
here is my code
/finvite
pawn Код:
CMD:finvite(playerid,params[])
{
new factionid;
if(pInfo[playerid][Faction] == 1)
{
new targetid, targetname[24], playername[24], string[128]; //Create the variables
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /finvite [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(pInfo[playerid][Adminlevel] != 5 && pInfo[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 have been invited to %s squad!", 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
pInfo[targetid][Faction] = 1; //Sets their faction variable to 0 (civilian)
pInfo[targetid][Rank] = 1; //Sets their rank variable to 0 (no rank)
}
if(pInfo[playerid][Faction] == 2)
{
new targetid, targetname[24], playername[24], string[128]; //Create the variables
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /finvite [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(pInfo[playerid][Adminlevel] != 5 && pInfo[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 have been invited to %s squad!", 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
pInfo[targetid][Faction] = 2; //Sets their faction variable to 0 (civilian)
pInfo[targetid][Rank] = 1; //Sets their rank variable to 0 (no rank)
}
if(pInfo[playerid][Faction] == 3)
{
new targetid, targetname[24], playername[24], string[128]; //Create the variables
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /finvite [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(pInfo[playerid][Adminlevel] != 5 && pInfo[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 have been invited to %s squad!", 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
pInfo[targetid][Faction] = 3; //Sets their faction variable to 0 (civilian)
pInfo[targetid][Rank] = 1; //Sets their rank variable to 0 (no rank)
}
if(pInfo[playerid][Faction] == 4)
{
new targetid, targetname[24], playername[24], string[128]; //Create the variables
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /finvite [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(pInfo[playerid][Adminlevel] != 5 && pInfo[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 have been invited to %s squad!", 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
pInfo[targetid][Faction] = 4; //Sets their faction variable to 0 (civilian)
pInfo[targetid][Rank] = 1; //Sets their rank variable to 0 (no rank)
}
return 1; //Returns a value
}
pawn Код:
CMD:fkick(playerid, params[]) //Format to create a command
{ //Open bracket
new id, string[128];
if(pInfo[playerid][Faction] == 1 && pInfo[playerid][Rank] == 6)
{
if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"Usage: /fkick [playerid]");
SendClientMessage(id,COLOR_RED,"You have been kicked from RAF squad!");
format(string,sizeof(string),"You have kicked %s(%d) from the squad",GetName(id),id);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
pInfo[id][Faction] = 0;
pInfo[id][Rank] = 0;
}
return 1;
} //Closed