Hi all, i have a problem , i try to make a simple admin cmd with wiki tutorial
Код:
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/faadmin", true) == 0)
{
new string[128];
new tmp[256];
new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
new giveplayerid;
if (IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF0000FF, "Foloseste: /faadmin [playerid] [level]");
SendClientMessage(playerid, 0xFF0000FF, "Functie: Jucatorul va fi admin.");
return 1;
}
giveplayerid = ReturnUser(tmp); - Here the problem !
tmp = strtok(cmdtext, idx);
new level = strval(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, player, sizeof(player));
PlayerInfo[giveplayerid][pAdminLevel] = level;
printf("Admin %s l-a facut pe %s nivel %d de admin.", player, giveplayer, level);
format(string, sizeof(string), "Ai fost facut nivel %d de Administrator de catre %s.", level, player);
SendClientMessage(giveplayerid, 0x00C2ECFF, string);
format(string, sizeof(string), "L-ai facut pe %s nivel %d de admin.", giveplayer,PlayerInfo[giveplayerid][pAdminLevel]);
SendClientMessage(playerid, 0x00C2ECFF, string);
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%i nu este activ.", giveplayerid);
SendClientMessage(playerid, 0xE60000FF, string);
}
}
else
{
SendClientMessage(playerid, 0xE60000FF, "Nu esti Proprietar!");
}
return 1;
}