Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------------------
- #include <a_samp>
- #include <zcmd>
- //--------------------
- #define DIALOG_WEAPON 1
- new CP[MAX_PLAYERS];
- main()
- {
- print("\n----------------------------------");
- print(" Checkpoints with Dialogs - JustinAn");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- SetGameModeText("Checkpoints with Dialogs - JustinAn");
- AddPlayerClass(299, 2489.9390,-1647.3156,14.0772, 180.2384, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- return 1;
- }
- public OnPlayerConnect(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("/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)
- {
- if(CP[playerid] == 1) // This checks if our variable equals to 1, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
- CP[playerid] = 4; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- GivePlayerWeapon(playerid, 30, 999999);
- SendClientMessage(playerid, -1, "Enjoy your weapon!");
- return 1;
- }
- if(CP[playerid] == 2) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
- CP[playerid] = 5; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- GivePlayerWeapon(playerid, 31, 999999);
- SendClientMessage(playerid, -1, "Enjoy your weapon!");
- }
- if(CP[playerid] == 2) // This checks if our variable equals to 2, if so: it continues
- {
- DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
- CP[playerid] = 6; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
- GivePlayerWeapon(playerid, 34, 999999);
- SendClientMessage(playerid, -1, "Enjoy your weapon!");
- }
- 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_WEAPON) // This checks if the dialog equals to the dialog define 'DIALOG_WEAPON', You can use a switch aswell, but i just prefer just to see the whole line
- {
- if(!response) return 0; // If you press the second button (No), the dialog dissapears and nothing happens
- if(response) // If there is a response (first button( Yes )) it continues
- {
- if(listitem == 0) // If you choose the first listitem, this happens
- {
- CP[playerid] = 1;
- SetPlayerCheckpoint(playerid, 2745.6499,-2453.8032,13.8623, 1.0);
- SendClientMessage(playerid, -1, "You have chosen the AK-47, follow the checkpoint to get the AK-47.");
- return 1;
- }
- if(listitem == 1) // If you choose the second listitem
- {
- CP[playerid] = 2;
- SetPlayerCheckpoint(playerid, 1579.4326,-1635.8755,13.5604, 1.0); // This creates a checkpoint at the coördinates: "-1051.4005,-655.8729,31.7361"
- SendClientMessage(playerid, -1, "You have chosen the M4, follow the checkpoint to get the M4.");
- return 1;
- }
- if(listitem == 2) // If you choose the third listitem
- {
- CP[playerid] = 3;
- SetPlayerCheckpoint(playerid, 1544.9388,-1353.3195,329.4743, 1.0); // This creates a checkpoint at the coördinates: "-2286.7529,2282.9390,5.9015"
- SendClientMessage(playerid, -1, "You have chosen the Sniper Rifle, follow the checkpoint to get the Sniper Rifle.");
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- // COMMANDS
- CMD:weapons(playerid, params[])
- {
- ShowPlayerDialog(playerid, DIALOG_WEAPON, DIALOG_STYLE_LIST, "Weapons", "AK47\nM4\nSniper Rifle", "Yes", "No");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment