Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- OmerT(Omer_Tabib or Rodrigez_Lopez) Simple Dini account and vehicle system with cmd to create a vehicle, -> for begginers <-
- Created: 12/02/2011 (Or 02/12/2011)
- dd/mm/yyyy
- The script is using sscanf2 and zcmd.
- Have fun!
- */
- #include <a_samp>
- #include <dini>
- #include <dudb>
- #include <float>
- #include <zcmd>
- #include <sscanf2>
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Blank Filterscript by your name here");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- #define MAX_CARS 200
- enum pInfo {
- pw,
- Level,
- Admin,
- Money,
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- enum vInfo {
- Model,
- Float:X,
- Float:Y,
- Float:Z,
- Float:R,
- Color1,
- Color2,
- }
- new VehicleInfo[MAX_CARS][vInfo];
- stock LoadVehicles()
- {
- new vfile[255];
- for(new vid = 1; vid < MAX_CARS; vid++) //Counting the vehicles files
- {
- format(vfile, sizeof(vfile), "Vehicles/%d.ini", vid); //The file name
- if(dini_Exists(vfile)) // Checks if the file exists, if he is so he will spawn IG
- {
- VehicleInfo[vid][Model] = dini_Int(vfile, "Model");
- VehicleInfo[vid][X] = dini_Int(vfile, "X");
- VehicleInfo[vid][Y] = dini_Int(vfile, "Y");
- VehicleInfo[vid][Z] = dini_Int(vfile, "Z");
- VehicleInfo[vid][R] = dini_Int(vfile, "R");
- VehicleInfo[vid][Color1] = dini_Int(vfile, "Color1");
- VehicleInfo[vid][Color2] = dini_Int(vfile, "Color2");
- CreateVehicle(VehicleInfo[vid][Model], VehicleInfo[vid][X], VehicleInfo[vid][Y], VehicleInfo[vid][Z], VehicleInfo[vid][R], VehicleInfo[vid][Color1], VehicleInfo[vid][Color2], 1);
- }
- }
- }
- main()
- {
- print("\n-----------------------------------------------");
- print(" Omer_Tabib Blank GM with Vehicles and Accounts");
- print("-------------------------------------------------\n");
- }
- #endif
- public OnGameModeInit()
- {
- LoadVehicles(); //The stock we created..
- SetGameModeText("Blank Script");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- 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)
- {
- new file[255];
- new pname[255];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(file, sizeof(file), "Users/%s.ini", pname);
- if(dini_Exists(file))
- {
- PlayerInfo[playerid][Level] = dini_Int(file, "Level");
- PlayerInfo[playerid][pw] = dini_Int(file, "pw");
- PlayerInfo[playerid][Admin] = dini_Int(file, "Admin");
- PlayerInfo[playerid][Money] = dini_Int(file, "Money");
- ShowPlayerDialog(playerid, 1001, DIALOG_STYLE_INPUT, "Login", "Type in your password", "Confirm", "Exit");
- }
- else if(dini_Create(file)){
- ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_INPUT, "Register", "Set your password", "Confirm", "Exit");
- SendClientMessage(playerid, 0xFFFFFF, "Welcome to (Change me at 118) Please Register!");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new file[255];
- new pname[255];
- new score = GetPlayerScore(playerid);
- new money = GetPlayerMoney(playerid);
- GetPlayerName(playerid, pname, sizeof(pname));
- format(file, sizeof(file), "Users/%s.ini", pname);
- if(dini_Exists(file))
- {
- dini_IntSet(file, "Level", score);
- dini_IntSet(file, "Money", money);
- dini_IntSet(file, "Admin", PlayerInfo[playerid][Admin]);
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
- 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("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- 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[])
- {
- switch(dialogid)
- {
- case 1000:
- {
- if(response == 1)
- {
- new file[255];
- new pname[255];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(file, sizeof(file), "Users/%s.ini", pname);
- if(dini_Exists(file))
- {
- dini_IntSet(file, "pw", num_hash(inputtext));
- dini_IntSet(file, "Level", 0);
- dini_IntSet(file, "Admin", 0);
- dini_IntSet(file, "Money", 500);
- GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
- }
- }
- else {
- Kick(playerid);
- }
- }
- case 1001:
- {
- if(response == 1)
- {
- if(num_hash(inputtext) == PlayerInfo[playerid][pw])
- {
- SendClientMessage(playerid, 0xFFFFFF, "Connected!");
- SetPlayerScore(playerid, PlayerInfo[playerid][Level]);
- SetPlayerMoney(playerid, PlayerInfo[playerid][Money]);
- }
- else {
- SendClientMessage(playerid, 0xFFFFFF, "Wrong Password!");
- ShowPlayerDialog(playerid, 1001, DIALOG_STYLE_INPUT, "Login", "Type in your password", "Confirm", "Exit");
- }
- }
- else {
- Kick(playerid);
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- CMD:createcar(playerid, params[])
- {
- new mid;
- new vfile[225];
- if(sscanf(params, "i", mid)) return SendClientMessage(playerid, 0xFFFFFF, "/createcar [ModelID]");
- else if(mid > 600 || mid < 400) return SendClientMessage(playerid, 0xFFFFF, "/createcar [ModelID 400-600]");
- else {
- for(new vid = 0; vid < MAX_CARS; vid++)
- {
- format(vfile, sizeof(vfile), "Vehicles/%d.ini", vid);
- if(dini_Exists(vfile)) //Checks if the file exists
- {
- vid++; //if it does so the counting will continue
- }
- else if(dini_Create(vfile)) //when the count got to an open slot he can create a new file now :)
- {
- new Float:x,Float:y,Float:z;
- new Float:a;
- new color1 = random(126);
- new color2 = random(126);
- GetPlayerPos(playerid,x,y,z);
- GetPlayerFacingAngle(playerid, a);
- dini_IntSet(vfile, "Model" , mid);
- dini_FloatSet(vfile, "X", x);
- dini_FloatSet(vfile, "Y", y);
- dini_FloatSet(vfile, "Z", z);
- dini_FloatSet(vfile, "R", a);
- dini_IntSet(vfile, "Color1", color1);
- dini_IntSet(vfile, "Color2", color2);
- CreateVehicle(mid, x, y, z, a, color1, color2, 1);
- SetPlayerPos(playerid, x,y,z+0.5);
- return 1; // DONT REPLACE THIS LINE!
- }
- }
- }
- return 1;
- }
- CMD:gmx(playerid, params[])
- {
- SendRconCommand("gmx");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement