pero yo quiero hacer esos comandos por un tutorial que estoy viendo y ademas esas linea no la tengo,
PHP код:
CMD:makeleader(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4) //Replace this with your player variable
{
new targetid, facid;//establishes a player and a faction id, to be typed in
if(sscanf(params,"ui",targetid, facid)) return SendClientMessage(playerid, COLOR_RED,"/makeleader [id][Faction id]");//if the command is misused it will tell them the correct way to use it
if(targetid != INVALID_PLAYER_ID)//checks if the id you type in is an id that is not connected to the server
{
PlayerInfo[targetid][pFaction] = facid; //sets the players faction to the faction you choose
PlayerInfo[targetid][pFacrank] = 10;//sets their rank to the highest rank
PlayerInfo[targetid][pFacleader] = facid;//sets their leadership to the id of the faction
if(facid == 1)//checks if the factionid typed was 1, and tells them they are the leader of the police below
{
SendClientMessage(targetid,COLOR_CYAN,"You have been made the leader of the San Andreas Police Department");
}
if(facid == 2)//checks if the factionid typed was 2, and tells them below, they are the leader of the faction
{
SendClientMessage(targetid,COLOR_CYAN,"You have been made the leader of the Federal Bureau of Investigation");//change this to the faction name you want
}
if(facid == 3)//checks if the factionid typed was 2, and tells them below, they are the leader of the faction
{
SendClientMessage(targetid,COLOR_CYAN,"You have been made the leader of the President of San Andreas");//change this to the faction name you want
}
if(facid == 4)//checks if the factionid typed was 2, and tells them below, they are the leader of the faction
{
SendClientMessage(targetid,COLOR_CYAN,"You have been made the leader of the San Andreas Medical Fire Department");//change this to the faction name you want
}
if(facid == 5)//checks if the factionid typed was 2, and tells them below, they are the leader of the faction
{
SendClientMessage(targetid,COLOR_CYAN,"You have been made the leader of the San Andreas News");//change this to the faction name you want
}
if(facid == 6)//checks if the factionid typed was 2, and tells them below, they are the leader of the faction
{
SendClientMessage(targetid,COLOR_CYAN,"You have been made the leader of the Taxi Company");//change this to the faction name you want
}
if(facid == 7)//checks if the factionid typed was 2, and tells them below, they are the leader of the faction
{
SendClientMessage(targetid,COLOR_CYAN,"You have been made the leader of the Hitmans");//change this to the faction name you want
}
}
}
else //if the player is not an admin it will show the below message telling them they are not an admin.
{
SendClientMessage(playerid, COLOR_RED, "Only certan levels of Administration have access to this command.");
}
return 1;
}
CMD:invite(playerid, params[])
{
if(PlayerInfo[playerid][pFacleader] > 0 || PlayerInfo[playerid][pFacrank] >= 8)//checks if the player is the leader of a faction or a high rank in it
{
new tarid, facid;//establishes a player in the server and a faction id for you to type in
if(sscanf(params, "u", tarid)) return SendClientMessage(playerid, COLOR_RED, "> USAGE: /invite [playerid]");//if the command is not typed correctly, it will show you the correct way to use the command.
facid = PlayerInfo[playerid][pFaction];//sets the faction the player is being invited to, as the faction the player that is inviting is in.
SetPVarInt(tarid, "invitefac", facid);//saves the invite, to /accept it
SendClientMessage(tarid, COLOR_GREEN, "You have been invited into a faction, use /acceptinvite to join");//tells you that you have been invited to a faction
}
else //if you're not the correct rank it will display the message below stating that the player is not the rank to invite
{
SendClientMessage(playerid, COLOR_RED, "You do not have the rank to invite");
}
return 1;
}
CMD:acceptinvite(playerid, params[])
{
new facid, string[128];//creates a faction id and some text on the players screen
facid = GetPVarInt(playerid, "invitefac");//calls the saved invite from the previous command
PlayerInfo[playerid][pFaction] = facid; //sets the players faction to that of the person inviting.
PlayerInfo[playerid][pFacrank] = 1;//sets the players faction rank to 1
format(string, sizeof(string), "> You have accepted the invite to faction %d", facid);//tells the player they have accepted the faction invite
SendClientMessage(playerid, COLOR_CYAN, string);//shows the above message in the color of CYAN
DeletePVar(playerid, "invitefac");//deletes the saved invite
return 1;
}
CMD:uninvite(playerid,params[])
{
if(PlayerInfo[playerid][pFacleader] > 0 || PlayerInfo[playerid][pFacrank] >= 8)//checks if the player is high enough rank to uninvite
{
new targetid;//establishes a person to use the command on in the server
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "/copuninvite [id]");//if the command is not typed correctly it will display how to do it the right way.
if(targetid != INVALID_PLAYER_ID)//checks if the id typed is an actual player on the server
{
PlayerInfo[targetid][pFaction] = 0;//uninvites the player from the faction
PlayerInfo[targetid][pFacrank] = 0;//sets the players rank to 0
PlayerInfo[targetid][pFacleader] = 0;//revokes leadership status
SendClientMessage(targetid,COLOR_CYAN,"You have been kicked from your faction.");//states you've been kicked from the faction to the player the command is used on.
}
}
else //if the player is not the sufficient rank to uninvinte it will state that in the chat
{
SendClientMessage(playerid, COLOR_RED, "You do not have the rank to uninvite");
}
return 1;
}
CMD:giverank(playerid, params[])
{
if(PlayerInfo[playerid][pFacleader] > 0 || PlayerInfo[playerid][pFacrank] >= 8)//checks if the player is high enough rank
{
new targetid, rank, string[128];//establishes a player to use the command on, the rank you want to set, and some words to tell the players the actions used on them.
if(sscanf(params, "ui", targetid, rank)) return SendClientMessage(playerid, COLOR_RED, "Usage: /coprank [playerid][rank]");//checks if the command was typed correctly
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "That player is not connected!");//if the player id typed is not connected it will state that to you.
if(PlayerInfo[targetid][pFaction] != PlayerInfo[playerid][pFaction]) return SendClientMessage(playerid, COLOR_RED, "That player is not in your faction!");//if the player is not in the same faction it will not let him set the rank.
if(rank < 1 || rank > 10) return SendClientMessage(playerid, COLOR_RED,"Rank must be 1-10");//checks if the rank number typed is above or below the correct numbers
PlayerInfo[targetid][pFacrank] = rank;//sets the players rank to the rank you choose
format(string, sizeof(string), "Your rank has been changed to rank %d!", rank);
SendClientMessage(targetid, COLOR_GREEN, string);//states that the players rank was changed
}
else //if the player is not the correct rank it will display this message below
{
SendClientMessage(playerid, COLOR_RED, "You do not have the rank to set ranks");
}
return 1;
}
CMD:r(playerid, params[]) return cmd_radio(playerid, params);
CMD:radio(playerid, params[])
{
new string[128], text[128], ctext[60], pname[MAX_PLAYER_NAME+1];//establishes a few things needed to tell the players name, rank, and the text he has written.
GetPlayerName(playerid, pname, sizeof(pname));//gets the name of the player using /radio
if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} /r(adio) [text]");//if /r is not used correctly it will tell you the correct way to use it
if(PlayerInfo[playerid][pFaction] == 1)//checks if the player is in the first faction
{
if(PlayerInfo[playerid][pFacrank] == 1){ ctext = "Cadet"; }//all of these check the players rank and
if(PlayerInfo[playerid][pFacrank] == 2){ ctext = "Officer"; }// sets each rank to a specific name
if(PlayerInfo[playerid][pFacrank] == 3){ ctext = "Senior Officer"; }
if(PlayerInfo[playerid][pFacrank] == 4){ ctext = "Corporal"; }
if(PlayerInfo[playerid][pFacrank] == 5){ ctext = "Sergeant"; }
if(PlayerInfo[playerid][pFacrank] == 6){ ctext = "Lieutenant"; }
if(PlayerInfo[playerid][pFacrank] == 7){ ctext = "Captain"; }
if(PlayerInfo[playerid][pFacrank] == 8){ ctext = "Commander"; }
if(PlayerInfo[playerid][pFacrank] == 9){ ctext = "Deputy Chief"; }
if(PlayerInfo[playerid][pFacrank] == 10){ ctext = "Chief"; }
format(string, sizeof(string), "%s %s: %s", ctext, pname, text);
if(PlayerInfo[playerid][pFaction] > 0)//if the player is not in a faction it will not send him any messages
{
SendCopMessage(COLOR_PDRAD, string);//calls a stock below that checks who the /r should be sent to
}
}
if(PlayerInfo[playerid][pFaction] == 2)//checks if the player is in the second faction
{
if(PlayerInfo[playerid][pFacrank] == 1){ ctext = "rank 1 name"; }//all of these check the players rank and
if(PlayerInfo[playerid][pFacrank] == 2){ ctext = "rank 2 name"; }// sets each rank to a specific name
if(PlayerInfo[playerid][pFacrank] == 3){ ctext = "rank 3 name"; }
if(PlayerInfo[playerid][pFacrank] == 4){ ctext = "rank 4 name"; }
if(PlayerInfo[playerid][pFacrank] == 5){ ctext = "rank 5 name"; }
if(PlayerInfo[playerid][pFacrank] == 6){ ctext = "rank 6 name"; }
if(PlayerInfo[playerid][pFacrank] == 7){ ctext = "rank 7 name"; }
if(PlayerInfo[playerid][pFacrank] == 8){ ctext = "rank 8 name"; }
if(PlayerInfo[playerid][pFacrank] == 9){ ctext = "rank 9 name"; }
if(PlayerInfo[playerid][pFacrank] == 10){ ctext = "rank 10 name"; }
format(string, sizeof(string), "%s %s: %s", ctext, pname, text);
if(PlayerInfo[playerid][pFaction] > 0)//if the player is not in a faction it will not send him any messages
{
SendfacnameMessage(COLOR_PDRAD, string);//calls a stock below that checks who the /r should be sent to
}
}
return 1;
}