03.10.2009, 03:33
K so basically i want to script a "/setlevel id level" Command but im not sure how, I want it so i can only give them admin if they are registered and logged in (im using my custom coded admin system in my gm) i tryed this but theres problems:
Line 430 = level[player1] = level[player1]+level;
Line 411 = new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
Код:
dcmd_setlevel(playerid,params[]) { if(logged[playerid] == 1) { if(level[playerid] >= 5) { 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(logged[player1] == 1) { GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname)); 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); format(string,sizeof(string),"You have made %s Level %d", playername, level); SendClientMessage(playerid,blue,string); format(string,sizeof(string),"Administrator %s has made %s Level %d",adminname, playername); new file[128], pname[MAX_PLAYER_NAME]; GetPlayerName(player1, pname, sizeof(pname)); format(file, sizeof(file), "\\Users\\%s.ini", pname); level[player1] = level[player1]+level; dini_IntSet(file, "level", level[player1]); 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"); }
Код:
C:\Users\user\Desktop\SAMP Server\Everything World\gamemodes\EverythingWorldTwoBeta.pwn(411) : warning 219: local variable "level" shadows a variable at a preceding level C:\Users\user\Desktop\SAMP Server\Everything World\gamemodes\EverythingWorldTwoBeta.pwn(430) : error 028: invalid subscript (not an array or too many subscripts): "level" C:\Users\user\Desktop\SAMP Server\Everything World\gamemodes\EverythingWorldTwoBeta.pwn(430) : warning 215: expression has no effect C:\Users\user\Desktop\SAMP Server\Everything World\gamemodes\EverythingWorldTwoBeta.pwn(430) : error 001: expected token: ";", but found "]" C:\Users\user\Desktop\SAMP Server\Everything World\gamemodes\EverythingWorldTwoBeta.pwn(430) : error 029: invalid expression, assumed zero C:\Users\user\Desktop\SAMP Server\Everything World\gamemodes\EverythingWorldTwoBeta.pwn(430) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
Line 411 = new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];