Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // tank.pwn
- // Small gamemode made my Hiddos
- // © Hiddos 2012
- #include <a_samp>
- #define COLOR_MSG 0x00FFFFFF
- // Change this to whatever time you want the firing blip to be shown.
- #define BLIP_INTERVAL (4000)
- // All spawn locations. Located in East-LV
- new Float:spawnpoints[24][4] = {
- {1891.6543,1162.9626,10.8277,179.6629},
- {2020.1410,1545.6776,10.8354,270.5736},
- {1923.2551,1987.0009,7.6011,274.0966},
- {2011.1720,2138.1384,10.8277,270.5751},
- {2107.2334,2509.0537,10.8279,270.6009},
- {2037.0105,2728.4507,10.8285,359.8666},
- {2346.9155,2759.0457,10.8275,269.3924},
- {2468.3284,2346.5156,10.8278,270.1937},
- {2455.7800,1912.3488,10.8723,0.1140},
- {2219.2756,1838.4451,10.8275,178.5154},
- {2177.5129,1678.4075,10.9383,181.0688},
- {2222.4519,1427.9548,10.8279,269.8378},
- {2232.9871,1283.1406,10.7522,0.1504},
- {2452.3577,1230.9578,10.8277,359.6593},
- {2548.3464,1145.7690,10.8276,90.5001},
- {2460.2100,921.6903,10.8275,0.3934},
- {2394.4424,1013.1955,10.8276,179.1484},
- {2274.9773,1123.3292,10.8274,246.0380},
- {2311.0989,1794.2229,10.8275,179.6785},
- {2475.0234,1778.8390,10.8276,269.3282},
- {2487.9351,1532.5677,10.7551,229.4505},
- {2917.1399,2093.4749,10.8210,87.6007},
- {2764.9453,1249.7780,10.7649,0.9013},
- {2583.8162,1032.7301,10.8279,89.6140}
- };
- new vehicle[MAX_PLAYERS];
- new lastfire[MAX_PLAYERS];
- forward Spawn(playerid);
- main()
- {
- print("\n----------------------------------");
- print(" Tank by Hiddos\n © Hiddos 2012");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- SetGameModeText("Tank");
- AddPlayerClass(287, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public Spawn(playerid)
- {
- SpawnPlayer(playerid);
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- // No class selection, immediate spawning.
- // It's not possible to use SpawnPlayer when a player connects to the server. Therefore we use a timer linked to Spawn(), which spawns the player.
- SetTimerEx("Spawn", 1, false, "i", playerid);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- // White on the TAB list, invisible on the minimap
- SetPlayerColor(playerid, 0xFFFFFF00);
- SendClientMessage(playerid, COLOR_MSG, "Welcome to the server! Use /about to know more about this script!");
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- // Delete vehicle
- DestroyVehicle(vehicle[playerid]);
- vehicle[playerid] = 0;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- // Setting world boundaries so the player doesn't exist east-LV
- SetPlayerWorldBounds(playerid, 2942.0432, 1841.6453, 2925.3669, 905.5538);
- // Fetch a random position and spawn the player.
- new rand = random(sizeof spawnpoints);
- vehicle[playerid] = CreateVehicle(432, spawnpoints[rand][0], spawnpoints[rand][1], spawnpoints[rand][2], spawnpoints[rand][3], -1, -1, 0);
- PutPlayerInVehicle(playerid, vehicle[playerid], 0);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- // Delete vehicle
- DestroyVehicle(vehicle[playerid]);
- vehicle[playerid] = 0;
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- // Secured deletion of vehicle. Vehicle destroyed = Kill player and respawn
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(vehicle[i] == vehicleid)
- {
- DestroyVehicle(vehicle[i]);
- vehicle[i] = 0;
- SetPlayerHealth(i, 0.0);
- break;
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- // Feel free to edit or throw away the credits. Just don't claim it as your own.
- if(!strcmp(cmdtext, "/about", true, 6))
- {
- SendClientMessage(playerid, COLOR_MSG, "You're playing a minimode called 'tank.pwn', created by Hiddos from the SA-MP forums.");
- SendClientMessage(playerid, COLOR_MSG, "This minimode was designed to have as few features as possible so new scripters can learn from it and edit it.");
- SendClientMessage(playerid, COLOR_MSG, "Your objective is to kill other players. When somebody fires a shell, they get highlighted on the minimap");
- SendClientMessage(playerid, COLOR_MSG, "for some time. This can help you to find other players. However, firing a bullet yourself allows other players to track you down too!");
- return 1;
- }
- return 0;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- // No vehicle-exit
- if(oldstate == PLAYER_STATE_DRIVER) PutPlayerInVehicle(playerid, vehicle[playerid], 0);
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- // Add a temporary blip on the radar map when somebody fires a shell
- if(newkeys & KEY_FIRE)
- {
- lastfire[playerid] = GetTickCount();
- SetPlayerColor(playerid, 0xFFFFFF88);
- }
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- // Delete the blip again after some seconds
- if(lastfire[playerid] != 0)
- {
- if(lastfire[playerid] + BLIP_INTERVAL < GetTickCount())
- {
- SetPlayerColor(playerid, 0xFFFFFF00);
- lastfire[playerid] = 0;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement