D:\Downloads\Copy of samp03aasvr_R3_win32\gamemodes\UGFREEDM.pwn(762) : error 035: argument type mismatch (argument 3)
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);
new file[256]; GetPlayerName(para1, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); dini_Set(file, "level", admlvl);
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "%s", name);
dini_Create(%s);
Originally Posted by teddyman
i already got summin that saves the file when they register
i ment how do i link it to it? |
new file[256];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(string), "\\Users\\%s.ini", pname);
dini_IntSet(file, "level", admlvl);
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];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(string), "\\Users\\%s.ini", pname);
dini_IntSet(file, "level", admlvl);
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
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;
}
if(strcmp(cmd, "/giveadmin", true) == 0)
{
new tmp[256], tmpp[256];
if(IsPlayerAdmin(playerid) || level[playerid] >= 4)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, color, "Usage: /giveadmin <id> <level (1-4)>");
new targetid = strval(tmp); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, color, "Invalid Player ID");
tmpp = strtok(cmdtext, idx);
if(!strlen(tmpp)) return SendClientMessage(playerid, color, "Usage: /giveadmin <id> <level (1-4)>");
new admlevel = strval(tmpp);
new str[128], name[24];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "\\Users\\%s.ini", name);
dini_IntSet(str, admlevel);
return 1;
}
else return SendClientMessage(playerid, color, "You're not allowed to use this command!");
}