Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Red Vs YEllow BY aVi.
- #include <a_samp>
- #define Red 1
- #define Yellow 2
- #define DIALOG_RULES
- new gTeam[MAX_PLAYERS];
- #define RedTeamColor 0xFF0000AA
- #define YellowTeamColor 0xFFFF00AA
- #define COLOR_RED 0xFF0000AA
- #define COLOR_YELLOW 0xFFFF00AA
- new Float:RedRandomSpawns[4][3] = {
- {-528.9855,-106.5116,63.2969},
- {-528.9855,-106.5116,63.2969},
- {-466.5234,-65.2756,60.0786},
- {-525.2863,-26.3262,60.2808}
- };
- new Float:YellowRandomSpawns[4][3] = {
- {108.0593,688.4122,5.7534},
- {73.7504,685.4804,5.5640},
- {73.7504,685.4804,5.5640},
- {139.1785,723.5793,6.2578}
- };
- /// Outside all callbacks //
- forward SetPlayerRandomRedSpawn(playerid); // Forwarding the function
- public SetPlayerRandomRedSpawn(playerid) // Setting it up
- {
- new rand = random(sizeof(RedRandomSpawns)); // Making it select random options instead of a definite one
- SetPlayerPos(playerid, RedRandomSpawns[rand][0], RedRandomSpawns[rand][1], RedRandomSpawns[rand][2]); // [rand] tag means random, [0] = X, [1] = Y, [2] = Z
- return 1;
- }
- /// Rest is same as above, just Cops replaced Criminals
- forward SetPlayerRandomYellowSpawn(playerid);
- public SetPlayerRandomYellowSpawn(playerid)
- {
- new rand = random(sizeof(YellowRandomSpawns));
- SetPlayerPos(playerid, YellowRandomSpawns[rand][0], YellowRandomSpawns[rand][1], YellowRandomSpawns[rand][2]);
- return 1;
- }
- main()
- {
- print("\n----------------------------------");
- print(" *******Red Vs Yellow By Avi******");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- SetGameModeText("Team Death Match");
- AddPlayerClass(19,-535.9205,-179.1865,78.4047,2.8661,22,100,25,250,0,0); // redteam
- AddPlayerClass(287,92.4479,637.9890,7.5454,186.4675,22,100,25,250,0,0); // yellowteam
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- switch(classid) // Switching between the classids
- {
- case 0/* The first classid is of the cops*/:
- {
- SetPlayerTeam(playerid, Red); // Setting players team
- GameTextForPlayer(playerid, "~r~Red Team", 3500, 6);
- SetPlayerRandomRedSpawn(playerid); // Screen msg for player to show what team
- }
- case 1/* The first classid is of the cops*/:
- {
- SetPlayerTeam(playerid, Yellow); // Same as above
- GameTextForPlayer(playerid, "~y~Yellow Team", 3500, 6);
- SetPlayerRandomYellowSpawn(playerid); // Same as above
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(GetPlayerTeam(playerid) == Red)
- {
- SetPlayerColor(playerid, RedTeamColor);
- SendClientMessage(playerid, COLOR_RED, "Your Now Part Of Red Team !"); // Set his color to CopsColor (BLUE)
- gTeam[playerid] = Red;
- /* Any other bonus you want for Cops team! A special gun, skin, color, attachedobject, A random spawn! */
- }
- else if(GetPlayerTeam(playerid) == Yellow)
- {
- SetPlayerColor(playerid, YellowTeamColor);
- SendClientMessage(playerid, COLOR_YELLOW, "Your Now Part Of Yellow Team !"); // Same as above but in this case, CriminalsColor (RED)
- gTeam[playerid] = Red;
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new pScore = GetPlayerScore(killerid);
- SetPlayerScore(killerid, pScore + 1 ); //1 is the amount of score you want to give it to the killer
- GivePlayerMoney(killerid,50);//50 is the amount of money you want to give it to the killer
- GameTextForPlayer(killerid,"Keep Killing !",2000,4);
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid,text[])
- {
- if(text[0] == '*') // : can be changed to whatever symbol u wanna use for player to enable the teamchat.
- {
- new string[128]; GetPlayerName(playerid, string, sizeof(string)); // Making the new's
- format(string, sizeof(string), "[Team Radio] %s: %s", string, text[1]); // Formatted the message
- printf("%s", string); // Printed it BOTH ingame + the server log
- for(new i = 0; i < MAX_PLAYERS; i++) // Getting the player team and color, required for formatting the msg.
- {
- if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid)) SendClientMessage(i, GetPlayerColor(playerid), string);
- }
- return 0;
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- return 1;
- }
- 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[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
- {
- if(issuerid != INVALID_PLAYER_ID)
- {
- if(gTeam[issuerid] == gTeam[playerid])
- {
- GameTextForPlayer(issuerid,"Dont Kill Team Mates !",2000,4);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement