23.08.2015, 12:04
I'm trying to make /aname command, but keeps on getting errors, These are my codes:
This is my code
Код:
C:\Users\Desktop\PR RP SCRIPT NEW\filterscripts\aname.pwn(23) : error 017: undefined symbol "aDuty" C:\Users\Desktop\PR RP SCRIPT NEW\filterscripts\aname.pwn(23) : warning 215: expression has no effect C:\Users\Desktop\PR RP SCRIPT NEW\filterscripts\aname.pwn(23) : error 001: expected token: ";", but found "]" C:\Users\Desktop\PR RP SCRIPT NEW\filterscripts\aname.pwn(23) : error 029: invalid expression, assumed zero C:\Users\Desktop\PR RP SCRIPT NEW\filterscripts\aname.pwn(23) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
Код:
#include <a_samp> #include <zcmd> #include <sscanf2> #include <dini> #pragma tabsize 0 #define COLOR_WHITE 0xFFFFFFAA #define COLOR_GREY 0xAFAFAFAA new IsPlayerLoggedIn[MAX_PLAYERS]; enum pInfo { pAdmin }; new PlayerInfo[MAX_PLAYERS][pInfo]; CMD:aname(playerid, params[]) { new string[128], file[32], text[MAX_PLAYER_NAME]; if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(sscanf(params, "s[24]", text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /aname [name]"); if(aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You must be off duty to change your admin name."); // Start of detecting space in name new end, temp[32], temp2[32]; end = strfind(text, " ",true); if(end != -1) { strmid(temp, text, 0, end); format(temp, sizeof(temp), "%s_", temp); strdel(text, 0, end); strmid(temp2, text, 1, strlen(text)); format(text, 24, ""); strcat(text, temp, sizeof(temp)); strcat(text, temp2, sizeof(temp2)); } // End of detecting space in name format(file, sizeof(file), "users/%s.ini", text); if(dini_Exists(file)) { format(file, sizeof(file), "users/%s.ini", RPNU(playerid)); if(strlen(dini_Get(file, "AdminName")) && strcmp(dini_Get(file, "AdminName"), text)) { SendClientMessage(playerid, COLOR_GREY, "Name is already in use."); return 1; } } format(string, sizeof(string), " You have changed your admin name to: {FF6347}%s", text); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "%s has changed their admin name to %s.", RPN(playerid), text); Log("logs/aname.log", string); format(file, sizeof(file), "users/%s.ini", RPNU(playerid)); format(file, sizeof(file), "users/%s.ini", dini_Get(file, "AdminName")); if(dini_Exists(file)) dini_Remove(file); format(file, sizeof(file), "users/%s.ini", RPNU(playerid)); dini_Set(file, "AdminName", text); format(file, sizeof(file), "users/%s.ini",dini_Get(file, "AdminName")); dini_Create(file); dini_Set(file, "OldName", RPNU(playerid)); dini_IntSet(file, "Admin", PlayerInfo[playerid][pAdmin]); dini_IntSet(file, "AdminAccount", 1); dini_IntSet(file, "Age", 25); dini_IntSet(file, "Gender", 1); dini_IntSet(file, "Tutorial", 1); dini_Set(file, "IP", PlayerInfo[playerid][pIP]); return 1; }