27.12.2010, 03:06
Hello
I followed a tutorial for the wiki-samp but during compilation there are errors
Help me please
I followed a tutorial for the wiki-samp but during compilation there are errors
Help me please
Код:
// This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT #include <a_samp> enum Info { AdminLevel, } new PlayerInfo[MAX_PLAYERS][Info]; #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" ... by Ducky"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n----------------------------------"); print(" ... by Ducky"); print("----------------------------------\n"); } #endif public OnPlayerConnect(playerid) { PlayerInfo[playerid][AdminLevel] = 0; return 1; } public OnPlayerSpawn(playerid) { if(IsPlayerAdmin(playerid)) SendClientMessageToAll(0xDEEE20FF, "Un Admin s'est connecter."); else SendClientMessageToAll(0xDEEE20FF, "Un Utilisateur vient de rejoindre Springfield."); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256], idx; cmdtext = strtok(cmdtext, idx); if(strcmp("/makeadmin", cmdtext, true) == 0) { new string[128]; new strtrok[256]; new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME]; new giveplayerid; if (IsPlayerAdmin(playerid)) { tmp = strtrok(cmdtext, idx); if(!strlen()) { SendClientMessage(playerid, ORANGE, "USAGE: /makeadmin [playerid] [level]"); SendClientMessage(playerid, ORANGE, "FUNCTION: Player will be an admin."); return 1; } giveplayerid = ReturnUser(tmp); tmp = strtok(cmdtext, idx); new level = strval(tmp); if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, player, sizeof(player)); PlayerInfo[giveplayerid][AdminLevel] = level; printf("Admin %s made %s a level %d admin.", player, giveplayer, level); format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, player); SendClientMessage(giveplayerid, 0x00C2ECFF, string); format(string, sizeof(string), "You have given %s level %d admin.", giveplayer,PlayerInfo[giveplayerid][AdminLevel]); SendClientMessage(playerid, 0x00C2ECFF, string); } else if(giveplayerid == INVALID_PLAYER_ID) { format(string, sizeof(string), "%i is not an active player.", giveplayerid); SendClientMessage(playerid, 0xE60000FF, string); } } else { SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!"); } return 1; } return 0; } public OnRconLoginAttempt(ip[], password[], success) { if(!success) //If the password was incorrect { printf("LOGIN RCON ECHOUE PAR IP %s MOT DE PASSE UTILISE %s",ip, password); new pip[16]; for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players { GetPlayerIp(i, pip, sizeof(pip)); if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login { SendClientMessage(i, 0xFFFFFFFF, "Mauvais Mot de Passe. Bye!"); //Send a message Ban(i); //They are now banned. } } } return 1; }
Код:
C:\Users\Collйgien\Desktop\Serveur\gamemodes\srp.pwn(105) : error 046: unknown array size (variable "cmdtext") C:\Users\Collйgien\Desktop\Serveur\gamemodes\srp.pwn(105) : error 017: undefined symbol "strtok" C:\Users\Collйgien\Desktop\Serveur\gamemodes\srp.pwn(114) : error 017: undefined symbol "tmp" C:\Users\Collйgien\Desktop\Serveur\gamemodes\srp.pwn(114) : error 012: invalid function call, not a valid address C:\Users\Collйgien\Desktop\Serveur\gamemodes\srp.pwn(114) : warning 215: expression has no effect C:\Users\Collйgien\Desktop\Serveur\gamemodes\srp.pwn(114) : warning 215: expression has no effect C:\Users\Collйgien\Desktop\Serveur\gamemodes\srp.pwn(114) : error 001: expected token: ";", but found ")" C:\Users\Collйgien\Desktop\Serveur\gamemodes\srp.pwn(114) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 6 Errors.