18.08.2009, 21:09
Hi all! I wanna to make a command for admins which will throw a player on some height. This will detect health hacks. But there is a problem
Full code of command.
And line 2841:
Could anybody help?
Код:
C:\DOCUME~1\86A9~1\0016~1\ladmin4.pwn(2841) : error 033: array must be indexed (variable "tmp2")
Код:
dcmd_up(playerid,params[]) { if(PlayerInfo[playerid][LoggedIn] == 1) { if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid)) { new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index); if(!strlen(params)) return SendClientMessage(playerid, red, " ПРАВКА: /up [playerid ] [height] [reason]"); new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128]; player1 = strval(tmp); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) { GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname)); CMDMessageToAdmins(playerid,"/up"); new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); SetPlayerPos(player1,x,y,z+tmp2); PlayerPlaySound(playerid,1190,0.0,0.0,0.0); PlayerPlaySound(player1,1190,0.0,0.0,0.0); if(strlen(tmp3)) { format(string,sizeof(string)," Вас подкинул админ %s [причина: %s]",adminname,params[3]); SendClientMessage(player1,COLOR_RED,string); format(string,sizeof(string)," Вы подкинули игрока %s [причина: %s]",playername,params[3]); return SendClientMessage(playerid,COLOR_RED,string); } else { format(string,sizeof(string)," Вас подкинул админ %s ",adminname); SendClientMessage(player1,COLOR_RED,string); format(string,sizeof(string)," Вы подкинули игрока %s ",playername); return SendClientMessage(playerid,COLOR_RED,string); } } else return SendClientMessage(playerid, red, " Нет такого игрока"); } else return SendClientMessage(playerid,red," ОШИБКА: У вас должен быть 2 уровень чтобы использовать эту команду"); } else return SendClientMessage(playerid,red," ОШИБКА: Вы должны залогиниться"); }
Код:
GetPlayerPos(player1,x,y,z); SetPlayerPos(player1,x,y,z+tmp2); PlayerPlaySound(playerid,1190,0.0,0.0,0.0);