Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================Includes=================================================================================================================================//
- #include <a_samp>
- #include <a_mysql>
- #include <streamer>
- //=============================================Defines==================================================================================================================================//
- #define db_host "secret"
- #define db_user "secret"
- #define db_db "secret"
- #define db_pass "secret"
- #define DIALOG_REGISTER 1
- #define DIALOG_LOGIN 2
- #define RAUDONA 0xFF0000FF
- #define MELYNA 0x0087FFFF
- #define LIME 0x19FF00FF
- //=============================================News=====================================================================================================================================//
- new manomysql;
- //=============================================Forwards=================================================================================================================================//
- forward OnUserCheck(playerid);
- //=============================================Callbacks================================================================================================================================//
- main()
- {
- print("==================================");
- print("NevLocus GameMode by haX0r");
- print("==================================");
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
- public OnGameModeInit()
- {
- //Game mode tipas
- SetGameModeText("NevLocus");
- //Žaidėjo spawn informacija
- AddPlayerClass(289, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- //MySQL
- manomysql = mysql_connect(db_host, db_user, db_db, db_pass);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
- public OnGameModeExit()
- {
- mysql_close(manomysql);
- 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 OnUserCheck(playerid)
- {
- new num_rows, num_fields;
- cache_get_data(num_rows, num_fields, manomysql);
- if(num_rows == 0)
- {
- //Register
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registracija", "Prašome įvesti sugalvotą slaptažodį!", "Registruotis", "Išeiti");
- }
- else
- {
- //Login
- }
- return 1;
- }
- //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
- public OnPlayerConnect(playerid)
- {
- new vardas [MAX_PLAYER_NAME], query[64];
- GetPlayerName(playerid, vardas, sizeof(vardas));
- format(query, sizeof(query), "SELECT id FROM user WHERE vardas='%s'", vardas);
- mysql_function_query(manomysql, query, true, "OnUserCheck", "i", playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp("/tr1", cmdtext, true, 10))
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- y = y + 5;
- x = x + 5;
- SetVehicleNumberPlate(CreateVehicle(560, x, y, z, 0, 229, 229, -1, 0), "Minerva");
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_REGISTER)
- {
- if(response)
- {
- //Slaptažodžio ilgis
- new vardas[MAX_PLAYER_NAME], query[64], slaptazodis[32];
- GetPlayerName(playerid, vardas, sizeof(vardas));
- if(strlen(inputtext) > 7)
- {
- mysql_escape_string(inputtext, slaptazodis, manomysql);
- format(query, sizeof(query), "INSERT INTO user (vardas, slaptazodis, keyp) VALUES ('%s', '%s')", vardas, inputtext);
- mysql_function_query(manomysql, query, false, "", "");
- SendClientMessage(playerid, LIME, "Sėkmingai užsiregistravote serveryje! Gero žaidimo");
- }
- else
- {
- SendClientMessage(playerid, MELYNA, "Slaptažodis turi būti bent 8 simbolių ilgio!");
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registracija", "Prašome įvesti sugalvotą slaptažodį!", "Registruotis", "Išeiti");
- }
- }
- else
- {
- Kick(playerid);
- SendClientMessage(playerid, RAUDONA, "Atšaukėte registraciją!");
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment