PDA

View Full Version : /makehelper help.


Tye Huntley
08/10/2011, 06:16 AM
Hello, I was wondering if someone could help me out.

I was wondering for when I do /makehelper on my roleplay server it says "You have been made a level 3 helper by %s" But I want it to say the rank name of what the got made into instead of the number.

if(strcmp(cmd, "/makehelper", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pHelper] >= 4 || PlayerInfo[playerid][pAdmin] >= 1337)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehelper [playerid/PartOfName] [level(1-5)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pHelper] = level;
printf("AdmCmd: %s has made %s a level %d helper", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d helper by %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a level %d helper.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are authorized to use this command.");
}
}
return 1;
}

This is the code I currently have if someone could help me +1 Reputation.

Thanks in advance,

Tye

Jason_Thunde
08/10/2011, 07:59 AM
if(strcmp(cmd, "/makehelper", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pHelper] >= 4 || PlayerInfo[playerid][pAdmin] >= 1337)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehelper [playerid/PartOfName] [level(1-5)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pHelper] = level;
new atext[40];
If(PlayerInfo[para1][pHelper] == 1) { atext = "Rank 1 Here"; }
If(PlayerInfo[para1][pHelper] == 2) { atext = "Rank 2 Here"; }
If(PlayerInfo[para1][pHelper] == 3) { atext = "Rank 3 Here"; }
If(PlayerInfo[para1][pHelper] == 4) { atext = "Rank 4 Here"; }
If(PlayerInfo[para1][pHelper] == 5) { atext = "Rank 5 Here"; }
printf("AdmCmd: %s has made %s a level %d helper", sendername, giveplayer, atext);
format(string, sizeof(string), " You have been promoted to a %s helper by %s", atext, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a %s helper.", giveplayer, atext);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are authorized to use this command.");
}
}
return 1;
}