SA-MP Forums Archive
Help with makeleader cmd.... - 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: Help with makeleader cmd.... (/showthread.php?tid=386895)



Help with makeleader cmd.... - Scrillex - 22.10.2012

PHP код:
CMD:makeleader(playeridparams[])
{
    new 
targetidfactionidstring[128], targetname[24], playername[24];
    if(
sscanf(params"ui"targetidfactionid)) return SendClientMessage(playerid, -1"Usage: /makeleader [playerid][factionid]"); //Checks if they typed in anything for the playerid and factionid parameters, and if they don't, return a client message.
    
if(pInfo[playerid][Adminlevel] != 6) return SendClientMessage(playerid, -1"You are not an admin"); //Checks if they are an admin.  Remember, change this to your admin variable, or use !IsPlayerAdmin to check if they aren't rcon admin.
    
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1"Invalid playerid!"); //Sends a message if the player is not connected
    
if(factionid 3//Checks if the factionid is between 0 and 3, and if so, continue.  You can also type this like so: if(factionid >= 1 && factionid <= 2) or if(factionid == 1 || factionid == 2)
    
{
        
GetPlayerName(playeridplayernamesizeof(playername)); //Gets the players name and saves it to the variable playername
        
GetPlayerName(targetidtargetnamesizeof(targetname)); //Gets the targets name and saves it to the variable targetname
        
format(stringsizeof(string), "You made %s leader of faction id %i!"targetnamefactionid); //Formats the string that you will receive
        
SendClientMessage(playerid, -1string); //Sends a message to the person who changes the other persons faction in a random color
        
format(stringsizeof(string), "You were made leader of faction id %i by %s"factionidplayername);//Formats the string that the player will receive
        
SendClientMessage(playerid, -1string); //Sends a message to the person who is made the faction leader
        
pInfo[playerid][Faction] == factionid//This line
        
pInfo[playerid][Leader] == 6//This line
    
}
    else return 
SendClientMessage(playerid, -1"Invalid factionid.  Factionid's: 1-2"); //Sends a message if the faction is NOT between 0 and 3
    
return 1;// Returns 1 to end the command, as we NEED to return a value.

Have 2 warnings.. Just idk why...

Код:
warning 215: expression has no effect
warning 215: expression has no effect



Re: Help with makeleader cmd.... - CentyPoo - 22.10.2012

Код:
 pInfo[playerid][Faction] = factionid;
 pInfo[playerid][Leader] = 6;
Don't use two "=" when you are assigning a value to it, == is only used when checking to see if the variable is equal to something.


Re: Help with makeleader cmd.... - Scrillex - 22.10.2012

Thanks mate for help worked fine