PLZ Help!!!!
#1

I have two warnings in gm:
D:\New folder\New folder\gamemodes\RPS.pwn(50966) : warning 219: local variable "Index" shadows a variable at a preceding level
D:\New folder\New folder\gamemodes\RPS.pwn(51003) : warning 219: local variable "Index" shadows a variable at a preceding level

problem is to dcmd_setlevel sidcmd_setvip

dcmd_setlevel(playerid,params[]) {
if(PlayerInfo[playerid][LoggedIn] == 1) {
if(PlayerInfo[playerid][Level] >= 13 || IsPlayerAdmin(playerid)) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /setlevel [playerid] [level]");
new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setlevel [playerid] [level]");
level = strval(tmp2);

if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
if(PlayerInfo[player1][LoggedIn] == 1) {
if(level > ServerInfo[MaxAdminLevel] ) return SendClientMessage(playerid,red,"ERROR: Incorrect Level");
if(level == PlayerInfo[player1][Level]) return SendClientMessage(playerid,red,"ERROR: Player is already this level");
CMDMessageToAdmins(playerid,"SETLEVEL");
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day; getdate(year, month, day); new hour,minute,second; gettime(hour,minute,second);

if(level > 0) format(string,sizeof(string),"Administrator %s has set you to Administrator Status [level %d]",adminname, level);
else format(string,sizeof(string),"Administrator %s has set you to Player Status [level %d]",adminname, level);
SendClientMessage(player1,blue,string);

if(level > PlayerInfo[player1][Level]) GameTextForPlayer(player1,"Promoted", 2000, 3);
else GameTextForPlayer(player1,"Demoted", 2000, 3);

format(string,sizeof(string),"You have made %s Level %d on %d/%d/%d at %d:%d:%d", playername, level, day, month, year, hour, minute, second); SendClientMessage(playerid,blue,string);
format(string,sizeof(string),"Administrator %s has made %s Level %d on %d/%d/%d at %d:%d:%d",adminname, playername, level, day, month, year, hour, minute, second);
SaveToFile("AdminLog",string);
dUserSetINT(PlayerName2(player1)).("level",(level) );
PlayerInfo[player1][Level] = level;
return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
} else return SendClientMessage(playerid,red,"ERROR: Player must be registered and logged in to be admin");
} else return SendClientMessage(playerid, red, "Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

dcmd_setvip(playerid,params[]) {
if(PlayerInfo[playerid][LoggedIn] == 1) {
if(PlayerInfo[playerid][Vip] >= 4 || IsPlayerAdmin(playerid)) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /setvip [playerid] [vip level]");
new player1, vip, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setvip [playerid] [vip level]"); vip = strval(tmp2);

if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
if(PlayerInfo[player1][LoggedIn] == 1) {
if(vip > ServerInfo[MaxVipLevel] ) return SendClientMessage(playerid,red,"ERROR: Incorrect vip Level");
if(vip == PlayerInfo[player1][Vip]) return SendClientMessage(playerid,red,"ERROR: Player is already this vip level");
CMDMessageToAdmins(playerid,"SETVIP");
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day; getdate(year, month, day); new hour,minute,second; gettime(hour,minute,second);

if(vip > 0) format(string,sizeof(string),"Administrator %s has set you to Vip Status [Vip level %d]",adminname, vip);
else format(string,sizeof(string),"Administrator %s has set you to Player Status [Vip level %d]",adminname, vip);
SendClientMessage(player1,blue,string);

if(vip > PlayerInfo[player1][Vip]) GameTextForPlayer(player1,"Promoted Vip", 2000, 3);
else GameTextForPlayer(player1,"Demoted Vip", 2000, 3);

format(string,sizeof(string),"You have made %s Vip Level %d on %d/%d/%d at %d:%d:%d", playername, vip, day, month, year, hour, minute, second); SendClientMessage(playerid,blue,string);
format(string,sizeof(string),"Administrator %s has made %s Vip Level %d on %d/%d/%d at %d:%d:%d",adminname, playername, vip, day, month, year, hour, minute, second);
SaveToFile("VipLog",string);
dUserSetINT(PlayerName2(player1)).("vip",(vip));
PlayerInfo[player1][Vip] = vip;
return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
} else return SendClientMessage(playerid,red,"ERROR: Player must be registered and logged in to be vip");
} else return SendClientMessage(playerid, red, "Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}


Are the only commands that do not work please help me
Reply
#2

Post it here sir, http://forum.sa-mp.com/newthread.php?do=newthread&f=12
Reply
#3

This is not appropriate forum-section.

Post it in Scripting Discussion, which can be found here: http://forum.sa-mp.com/forumdisplay.php?f=12 !

Regards!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)