Scripting help /makeadmin
#1

Ok, i got the coding for /makeadmin already, and where it says something like Vincnet_Johnson has promoted Drew_Anders to a level 9999 Admin (it says who promoted who, and what level), i want it to also be something like Vincent_Johnson has demoted Drew_Anders to a level 1 Admin (if they got demoted), and also need it to say something like Vincent_Johnson has removed Drew_Anders admin (if we completely remove someones admin). Would any of you know how to do it?


Here's the coding

if(strcmp(cmd,"/makeadmin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level(1-3)]");
return 1;
}
if(PlayerInfo[playerid][pDisabled] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, " You can't use this command ! You're Disabled !");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s.", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
ABroadCast(COLOR_SACBLUE,string, 2);
OnPlayerSave(playerid);
OnPlayerSave(para1);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
Reply
#2

This is very hard to understand. Add [pawn] tags for your Pawno codes and indent your lines.
Reply
#3

you just copied this from some where without defining anything thats why it is like that
pawn Код:
if(strcmp(cmd,"/makeadmin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level(1-3)]");
return 1;
}
if(PlayerInfo[playerid][pDisabled] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, " You can't use this command ! You're Disabled !");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s.", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
ABroadCast(COLOR_SACBLUE,string, 2);
OnPlayerSave(playerid);
OnPlayerSave(para1);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)