21.02.2014, 10:28
Код:
// This Register-Login-Saving System is by Tuntun ( Me). // Please do not remove my credit or do not try to edit this script and post in SA-MP/Any forums without my permission. #include <a_samp> #include <zcmd> #include <YSI\y_ini> // News new PilotJob[256]; // defines #define DIALOG_REGISTER 1 #define DIALOG_LOGIN 2 #define DIALOG_SUCCESS_1 3 #define DIALOG_SUCCESS_2 4 // Define the register Path. #define PATH "Beta/Users/%s.ini" // dialog colors #define COL_WHITE "{FFFFFF}" #define COL_RED "{F81414}" #define COL_GREEN "{00FF22}" #define COL_LIGHTBLUE "{00CED1}" #define COL_MATI "{0xFF8000FF}" #define COL_LAL "{0xFF0000FF}" // colors #define COLOR_GREY 0xAFAFAFAA #define COLOR_GREY 0xAFAFAFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_LIGHTGREEN 0x7FFF00 #define COLOR_DARKGREEN 0x006400 #define COLOR_LIGHTBLUE 0x91C8FF #define COLOR_ORANGE 0xFF9900AA #define COLOR_GROUPTALK 0x87CEEBAA #define COLOR_MENU 0xFFFFFFAA #define COLOR_SYSTEM_PM 0x66CC00AA #define COLOR_SYSTEM_PW 0xFFFF33AA #define COLOR_MATI 0xFF8000FF #define COLOR_RED 0xFF0000FF // enums enum pInfo { pVehicle, pPass, pCash, pAdmin, pKills, pDeaths } new PlayerInfo[MAX_PLAYERS][pInfo]; forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Password",PlayerInfo[playerid][pPass]); INI_Int("Cash",PlayerInfo[playerid][pCash]); INI_Int("Admin",PlayerInfo[playerid][pAdmin]); INI_Int("Kills",PlayerInfo[playerid][pKills]); INI_Int("Deaths",PlayerInfo[playerid][pDeaths]); INI_Int("Vehicle",PlayerInfo[playerid][pDeaths]); return 1; } // stock stock UserPath(playerid) { new string[128],playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),PATH,playername); return string; } stock udb_hash(buf[]) { new length=strlen(buf); new s1 = 1; new s2 = 0; new n; for (n=0; n<length; n++) { s1 = (s1 + buf[n]) % 65521; s2 = (s2 + s1) % 65521; } return (s2 << 16) + s1; } main() { print("\n----------------------------------"); print(" Beta Server by Tuntun"); print("----------------------------------\n"); } public OnGameModeInit() { AddStaticVehicle(519,1277.1787,1324.1875,11.7372); // shamal 1 return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; } public OnPlayerConnect(playerid) { if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Register your account",""COL_WHITE"Type your password below to register a new account.","Register","Quit"); } return 1; } public OnPlayerDisconnect(playerid, reason) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)); INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]); INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]); INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]); INI_Close(File); return 1; } public OnPlayerSpawn(playerid) { return 1; } public OnPlayerDeath(playerid, killerid, reason) { PlayerInfo[killerid][pKills]++; PlayerInfo[playerid][pDeaths]++; return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { SendClientMessage(playerid,COLOR_MATI,"Please do not spam"); return 1; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { return 1; } public OnPlayerEnterCheckpoint(playerid) { if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 591) { if(PilotJob[playerid] == 1){ PilotJob[playerid] = 2; SetPlayerCheckpoint(playerid,1570.9003,1504.5070,10.8370); SendClientMessage(playerid, -1, "Go to the {FF0000}red check-point{FFFFFF} to un-load passengers!"); return 1; } if(PilotJob[playerid] == 2){ PilotJob[playerid] = 3; SetPlayerCheckpoint(playerid,1561.4513,-2414.2122,13.5547); SendClientMessage(playerid, -1, "Go to the {FF0000}red check-point{FFFFFF} to un-load passengers!"); return 1; } if(PilotJob[playerid] == 3){ PilotJob[playerid] = 0; SendClientMessage(playerid, -1, "You have earned {FF0000}2500$"); GivePlayerMoney(playerid, 2500); GetPlayerScore(playerid, 2); DisablePlayerCheckpoint(playerid); return 1; } } public OnPlayerExitVehicle(playerid, vehicleid) { if(PilotJob[playerid] > 0) { PilotJob[playerid] = 0; SendClientMessage(playerid, -1,"{FF0000}Mission has been canceled due to you exited the vehicle!"); DisablePlayerCheckpoint(playerid); } } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_RED"Success!",""COL_RED"Congratulations! You are registered!!","Ok",""); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_RED"You have successfully logged in!","Ok",""); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit"); } return 1; } } } return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; } public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if (!success) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[Error]:{FFFFFF} Wrong Command"); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/work", cmdtext, true, 0) == 0) { if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 591) { PilotJob[playerid] = 1; SetPlayerCheckpoint(playerid,1561.4513,-2414.2122,13.5547); SendClientMessage(playerid, -1, "Mission started,Go to the {FF0000}red check-point{FFFFFF} to board passangers"); return 1; } SendClientMessage(playerid, COLOR_RED,"{FF0000}You have to be in a flying vehicle to start a mission"); }
Код:
E:\Flying\gamemodes\Flying.pwn(100) : warning 202: number of arguments does not match definition E:\Flying\gamemodes\Flying.pwn(100) : warning 202: number of arguments does not match definition E:\Flying\gamemodes\Flying.pwn(100) : warning 202: number of arguments does not match definition E:\Flying\gamemodes\Flying.pwn(192) : warning 202: number of arguments does not match definition E:\Flying\gamemodes\Flying.pwn(198) : warning 202: number of arguments does not match definition E:\Flying\gamemodes\Flying.pwn(206) : warning 202: number of arguments does not match definition E:\Flying\gamemodes\Flying.pwn(211) : warning 217: loose indentation E:\Flying\gamemodes\Flying.pwn(211) : error 029: invalid expression, assumed zero E:\Flying\gamemodes\Flying.pwn(211) : error 017: undefined symbol "vehicleid" E:\Flying\gamemodes\Flying.pwn(220) : error 029: invalid expression, assumed zero E:\Flying\gamemodes\Flying.pwn(220) : error 004: function "S@@_OnDialogResponse" is not implemented E:\Flying\gamemodes\Flying.pwn(222) : error 017: undefined symbol "dialogid" E:\Flying\gamemodes\Flying.pwn(226) : error 017: undefined symbol "response" E:\Flying\gamemodes\Flying.pwn(227) : error 017: undefined symbol "response" E:\Flying\gamemodes\Flying.pwn(229) : error 017: undefined symbol "inputtext" E:\Flying\gamemodes\Flying.pwn(232) : error 017: undefined symbol "inputtext" E:\Flying\gamemodes\Flying.pwn(247) : error 017: undefined symbol "response" E:\Flying\gamemodes\Flying.pwn(248) : error 017: undefined symbol "response" E:\Flying\gamemodes\Flying.pwn(250) : error 017: undefined symbol "inputtext" E:\Flying\gamemodes\Flying.pwn(266) : warning 225: unreachable code E:\Flying\gamemodes\Flying.pwn(266) : error 029: invalid expression, assumed zero E:\Flying\gamemodes\Flying.pwn(266) : error 004: function "S@@_OnPlayerClickPlayer" is not implemented E:\Flying\gamemodes\Flying.pwn(270) : warning 225: unreachable code E:\Flying\gamemodes\Flying.pwn(270) : error 029: invalid expression, assumed zero E:\Flying\gamemodes\Flying.pwn(270) : error 004: function "OnPlayerCommandPerformed" is not implemented E:\Flying\gamemodes\Flying.pwn(272) : error 017: undefined symbol "success" E:\Flying\gamemodes\Flying.pwn(275) : warning 225: unreachable code E:\Flying\gamemodes\Flying.pwn(275) : error 029: invalid expression, assumed zero E:\Flying\gamemodes\Flying.pwn(275) : error 004: function "S@@_OnPlayerCommandText" is not implemented E:\Flying\gamemodes\Flying.pwn(277) : error 017: undefined symbol "cmdtext" E:\Flying\gamemodes\Flying.pwn(282) : warning 202: number of arguments does not match definition E:\Flying\gamemodes\Flying.pwn(286) : warning 217: loose indentation E:\Flying\gamemodes\Flying.pwn(289) : error 030: compound statement not closed at the end of file (started at line 277) Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 21 Errors.