SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 21/08/2012, 01:16 PM   #1
Guitar
Huge Clucker
 
Guitar's Avatar
 
Join Date: Feb 2012
Location: ►░▒▓♫♪▓▒░◄
Posts: 357
Reputation: 3
Default Nothing is wrong but it sends wrong text?

Hello,

I have scripted this /setadmin command to set admins, and when for example I set an admin to level 1 as a Trial admin, it tells that I set him as a Basic which is level 2 but he is level 1. So, check this cmd for me and please if there is another way to make it please help me doing it:

Code:
CMD:setadmin(playerid, params[])
{
	if(IsPlayerAdmin(playerid))
	{
	    new targetid, level;
		new sendername[32], string[128];
		if(sscanf(params, "ui", targetid, level))
		{
            SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setadmin <playerid> <level>");
			return 1;
		}
		if(level > 5 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "> Don't go below 0 or higher then 5!"); return 1; }

		if(IsPlayerConnected(targetid))
		{
		    new ranktext[32];
		    if(PlayerInfo[targetid][pAdmin] == 1) { ranktext = "Trial Admin"; }
			else if(PlayerInfo[targetid][pAdmin] == 2) { ranktext = "Basic Admin"; }
			else if(PlayerInfo[targetid][pAdmin] == 3) { ranktext = "Lead Admin"; }
			else if(PlayerInfo[targetid][pAdmin] == 4) { ranktext = "Head Admin"; }
			else if(PlayerInfo[targetid][pAdmin] == 5) { ranktext = "Owner"; }
			else
		 	{
		 		return 1;
		 	}
			PlayerInfo[targetid][pAdmin] = level;
			SavePlayerStats(playerid);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string),"> Admin %s has promoted you to a %s", sendername, ranktext);
 			SendClientMessage(targetid, 0xFFFFFFFF, string);
    	}
	}
	else return SendClientMessage(playerid, 0xFFFFFFFF, "Only Admins can perform this action.");
	return 1;
}
Thank you!
__________________
3habGamingY_INI Registration system
Click meClick me
Code:
funland.dyndns.org:7777 - Connect and test my work :) [Tutorial] Making a registration system - Using "Y_INI + Whirlpool + Dialogs" 3habGaming is looking for members/helpers/staff - www.3habgaming.icyboards.net :oops:. I am interested in learning the basics to a Roleplay GM.
Jansish is great :) + I hate Dialogs :(
Guitar is offline   Reply With Quote
Old 21/08/2012, 01:30 PM   #2
Sasoft
Big Clucker
 
Sasoft's Avatar
 
Join Date: Nov 2011
Location: My Files
Posts: 136
Reputation: 8
Default Re: Nothing is wrong but it sends wrong text?

I think this will do
pawn Code:
CMD:setadmin(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new targetid, level;
        new sendername[32], string[128];
        if(sscanf(params, "ui", targetid, level))
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setadmin <playerid> <level>");
            return 1;
        }
        if(level > 5 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "> Don't go below 0 or higher then 5!"); return 1; }

        if(IsPlayerConnected(targetid))
        {
            new ranktext[32];
            else if(PlayerInfo[targetid][pAdmin] == 5) { ranktext = "Owner"; }
            else if(PlayerInfo[targetid][pAdmin] == 4) { ranktext = "Head Admin"; }
            else if(PlayerInfo[targetid][pAdmin] == 3) { ranktext = "Lead Admin"; }
            else if(PlayerInfo[targetid][pAdmin] == 2) { ranktext = "Basic Admin"; }
            else if(PlayerInfo[targetid][pAdmin] == 1) { ranktext = "Trial Admin"; }
            else { ranktext = "Trial Admin"; }
            PlayerInfo[targetid][pAdmin] = level;
            SavePlayerStats(playerid);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string),"> Admin %s has promoted you to a %s", sendername, ranktext);
            SendClientMessage(targetid, 0xFFFFFFFF, string);
        }
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF, "Only Admins can perform this action.");
    return 1;
}
Sasoft 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
Wrong Command Text Help Irock23 Scripting Help 7 29/08/2011 11:02 PM
showing wrong/wrong string TextDraws Voldemort Help Archive 5 22/02/2011 05:50 PM
Well, it's all gone wrong. 06leachr Help Archive 11 30/12/2010 08:11 PM
something wrong with 3D text lable WardenCS Help Archive 1 29/12/2009 09:03 PM


All times are GMT. The time now is 07:24 PM.


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