How to make a command to be activated by an admin -
KiM0Ro - 10.09.2014
Hi i want to know how to make this command to can be activated only when i type, /giftcomand,and to can be activated only by admin 6,thanks
if (strcmp(cmd, "/firstgift", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Nu esti logat!");
return 1;
}
if (hasgotgift == 1) return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Deja ai primit cadoul!");
if (PlayerInfo[playerid][pLevel] < 2)
{
SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Trebuie sa ai level 2!");
return 1;
}
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] +250000;
PlayerInfo[playerid][pLevel] = PlayerInfo[playerid][pLevel] +1;
format(string, 256, "{00FF00}Felicitari,prin acest cadou ne aniversam deschiderea!",PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 256, "{00FF00}Ai primit 1 level!",PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 256, "{00FF00}Ai primit 250.000$!",PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_WHITE, string);
hasgotgift = 1;
}
return 1;
}
Re: How to make a command to be activated by an admin -
shourya12 - 10.09.2014
Код:
if (strcmp(cmd, "/firstgift", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Nu esti logat!");
return 1;
}
if (hasgotgift == 1) return SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Deja ai primit cadoul!");
if (PlayerInfo[playerid][pLevel] < 6)
{
SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Trebuie sa ai level 6!");
return 1;
}
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] +250000;
PlayerInfo[playerid][pLevel] = PlayerInfo[playerid][pLevel] +1;
format(string, 256, "{00FF00}Felicitari,prin acest cadou ne aniversam deschiderea!",PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 256, "{00FF00}Ai primit 1 level!",PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 256, "{00FF00}Ai primit 250.000$!",PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_WHITE, string);
hasgotgift = 1;
}
return 1;
}
Re: How to make a command to be activated by an admin -
HazardouS - 10.09.2014
Just add an if-statement like this in your firstgift command:
pawn Код:
if(CommandActivated == 0) return 1; //error
and make another command to set the CommandActivated variable to 1 or 0.
Re: How to make a command to be activated by an admin -
KiM0Ro - 10.09.2014
But i don't think to do that,please anyone can help me?
Re: How to make a command to be activated by an admin -
KiM0Ro - 10.09.2014
Help?
Re: How to make a command to be activated by an admin -
SanAndreasMP - 10.09.2014
pawn Код:
if (strcmp(cmd, "/firstgift", true) == 0)
{
if//you admin variable here. For ex - pData[playerid][Admin]>= 6)
{
if(IsPlayerConnected(playerid))
{
if (gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}Nu
esti logat!");
return 1;
}
if (hasgotgift == 1) return SendClientMessage(playerid,
COLOR_GRAD1, "{FF0000}Deja ai primit cadoul!");
if (PlayerInfo[playerid][pLevel] < 2)
{
SendClientMessage(playerid, COLOR_GRAD1, "{FF0000}
Trebuie sa ai level 2!");
return 1;
}
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]
+250000;
PlayerInfo[playerid][pLevel] = PlayerInfo[playerid][pLevel]
+1;
format(string, 256, "{00FF00}Felicitari,prin acest cadou ne
aniversam deschiderea!",PlayerInfo[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 256, "{00FF00}Ai primit 1 level!",PlayerInfo
[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 256, "{00FF00}Ai primit 250.000$!",PlayerInfo
[playerid][gPupgrade]);
SendClientMessage(playerid, COLOR_WHITE, string);
hasgotgift = 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You're not administrator.");
}
return 1;
}