Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onServerStart()
- {
- // Here put your CreatePickups copied from pickups.txt
- print("pickups loaded")
- }
- function onPlayerCommand(player,command,text)
- {
- if ( command == "pickup" )
- {
- local v = player.Pos;
- if (!text) {
- MessagePlayer("Pickups list: bat,pistol,uzi,shotgun,ak47,m16,sniper,heal,armour",player)
- }
- if (text == "bat" || text == "baseballbat" )
- {
- WriteFile( "CreatePickup( 172, Vector(" + v.x + ", " + v.y + ", " + v.z + ")); // BASEBALL BAT", "Pickups.txt" )
- MessagePlayer("Baseball bat saved to pickups.txt", player );
- }
- else if (text == "pistol" || text == "colt45" )
- {
- WriteFile( "CreatePickup( 173, Vector(" + v.x + ", " + v.y + ", " + v.z + ")); // PISTOL", "Pickups.txt" )
- MessagePlayer("colt45 saved to pickups.txt", player );
- }
- else if (text == "uzi" || text == "smg" )
- {
- WriteFile( "CreatePickup( 178, Vector(" + v.x + ", " + v.y + ", " + v.z + ")); // UZI", "Pickups.txt" )
- MessagePlayer("uzi saved to pickups.txt", player );
- }
- else if (text == "shotgun" || text == "pump" )
- {
- WriteFile( "CreatePickup( 176, Vector(" + v.x + ", " + v.y + ", " + v.z + ")); // SHOTGUN", "Pickups.txt" )
- MessagePlayer("shotgun saved to pickups.txt", player );
- }
- else if (text == "ak47" || text == "ak" )
- {
- WriteFile( "CreatePickup( 171, Vector(" + v.x + ", " + v.y + ", " + v.z + ")); // AK-47", "Pickups.txt" )
- MessagePlayer("ak47 saved to pickups.txt", player );
- }
- else if (text == "m16" || text == "m4" )
- {
- WriteFile( "CreatePickup( 180, Vector(" + v.x + ", " + v.y + ", " + v.z + ")); // M16", "Pickups.txt" )
- MessagePlayer("m16 saved to pickups.txt", player );
- }
- else if (text == "sniper" || text == "sniperrifle" )
- {
- WriteFile( "CreatePickup( 177, Vector(" + v.x + ", " + v.y + ", " + v.z + ")); // SNIPER", "Pickups.txt" )
- MessagePlayer("sniper saved to pickups.txt", player );
- }
- else if (text == "heal" || text == "health" )
- {
- WriteFile( "CreatePickup( 1362, Vector(" + v.x + ", " + v.y + ", " + v.z + ")); // HEALTH", "Pickups.txt" )
- MessagePlayer("Health saved to pickups.txt", player );
- }
- else if (text == "armour" || text == "armor" )
- {
- WriteFile( "CreatePickup( 1364, Vector(" + v.x + ", " + v.y + ", " + v.z + ")); // ARMOUR", "Pickups.txt" )
- MessagePlayer("armour saved to pickups.txt", player );
- }
- }
- }
- // append string to file ( thanks to ankris )
- function WriteFile(text, f = "file.xt") {
- local f = file(f, "a+");
- if (!f) return false;
- foreach(idx, val in text) {
- f.writen(val, 'b');
- }
- f.writen('\n', 'b');
- f.flush();
- f.close();
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement