/setadmin command help -
SilentSoul - 28.08.2013
Hello guys, i am newbie at scripting so i wonder to create my own gamemode i already learned how to create login/register system and save player stats from here
https://sampforum.blast.hk/showthread.php?tid=167937
I already create my own /setvip from my own mind.
Код:
CMD:setvip(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, -1, "{FF0000}[ERROR]:{FAF5F5}You are not{FF0000} Administrator {FAF5F5} to use this command");
if (sscanf(params, "u", playerid))
{
return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[SYSTEM USAGE]:{FAF5F5}/setvip [[playerid]");
}
new id, string[126];
format (string, sizeof (string),"{FF0000}[Administrator]:{FAF5F5}%s has promote you to vip player!",GetPlayerNameEx(playerid));
SendClientMessage(id,-1,string);
format (string, sizeof (string),"{FF0000}[Administrator command]:{FAF5F5}you have promote %s to vip player!",GetPlayerNameEx(id));
SendClientMessage(playerid,-1,string);
PlayerInfo[playerid][pVip] = 1;
return 1;
}
Код:
enum pInfo
{
pAdminLevel,
pCash,
pScore,
pVip
}
I already searched on ****** put i just wanna help on levels with the same type i create /setvip system to be saved in player.ini file if you would like to help me will be great, sorry for my bad english.
Re: /setadmin command help -
ProjectMan - 28.08.2013
Well 'your own mind' overlooked some mistakes:
pawn Код:
format (string, sizeof (string),"{FF0000}[Administrator command]:{FAF5F5}you have promote %s to vip player!",GetPlayerNameEx(id));
SendClientMessage(playerid,-1,string);
That line will only be shown to yourself. I suggest you make a function which checks if that player is an admin, it will send that message to them. If you want, I will make it for you. Next:
pawn Код:
PlayerInfo[playerid][pVip] = 1;
That only sets the pVip to yourself. change it to:
pawn Код:
PlayerInfo[id][pVip] = 1;
pawn Код:
CMD:setadmin(playerid, params[])
{
new id, string[126], level;
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, -1, "{FF0000}[ERROR]:{FAF5F5}You are not{FF0000} Administrator {FAF5F5}to use this command");
if (sscanf(params, "ui", id, level))
{
return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[SYSTEM USAGE]:{FAF5F5}/setadmin [Player ID/Part of name] [level]");
}
format (string, sizeof (string),"{FF0000}[Administrator]:{FAF5F5}%s has promote you to admin level %d",GetPlayerNameEx(playerid), level);
SendClientMessage(id,-1,string);
format (string, sizeof (string),"{FF0000}[Administrator command]:{FAF5F5}you have promote %s to vip player!",GetPlayerNameEx(id));
SendClientMessage(playerid,-1,string);
PlayerInfo[id][pAdminLeve] = level;
return 1;
}
Re: /setadmin command help -
nor15 - 28.08.2013
pawn Код:
CMD:setadmin(playerid, params[])
{
new ID , level;
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, -1, "{FF0000}[ERROR]:{FAF5F5}You are not{FF0000} Administrator {FAF5F5} to use this command");
if (sscanf(params, "ui", ID,level))
{
return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[SYSTEM USAGE]:{FAF5F5}/setadmin [playerid] [Level]");
}
string[126];
format (string, sizeof (string),"{FF0000}[Administrator]:{FAF5F5}%s has promote you to amdin level %d!",GetPlayerNameEx(playerid),level);
SendClientMessage(ID,-1,string);
format (string, sizeof (string),"{FF0000}[Administrator command]:{FAF5F5}you have promote %s to vip player!",GetPlayerNameEx(ID));
SendClientMessage(playerid,-1,string);
PlayerInfo[ID][pAdminLevel] = level;
return 1;
}
Didn't Test , but i think it gonna work.
Re: /setadmin command help -
SilentSoul - 28.08.2013
Thank you for helping i will check this out and about the mistake in
Код:
format (string, sizeof (string),"{FF0000}[Administrator command]:{FAF5F5}you have promote %s to vip player!",GetPlayerNameEx(id));
SendClientMessage(playerid,-1,string);
I already edit now thanks!