04.12.2009, 19:52
I am trying to get a giveadmin command to work exept it comes up with this error
the command is
and if i set
to
It compile but does not set the level when i change it
Код:
D:\Downloads\Copy of samp03aasvr_R3_win32\gamemodes\UGFREEDM.pwn(762) : error 035: argument type mismatch (argument 3)
pawn Код:
dcmd_giveadmin(playerid, cmdtext[])
{
new idx;
new tmp[256];
new string[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /giveadmin [playerid/PartOfName] [level(1-4)]");
return 1;
}
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new para1;
new admlvl;
if(IsStringAName(tmp))
{
para1 = GetPlayerID(tmp);
}
else
{
para1 = strval(tmp);
}
tmp = strtok(cmdtext, idx);
admlvl = strval(tmp);
if(level[playerid] >= 4)
{
new file[256];
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
dini_Set(file, "level", admlvl);
printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, admlvl);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", admlvl, sendername);
SendClientMessage(para1, COLOR_RED, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,admlvl);
SendClientMessage(playerid, COLOR_RED, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, " you are not authorized to use that command!");
}
return 1;
}
Код:
dini_Set(file, "level", admlvl);
Код:
dini_IntSet(file, "level", admlvl);