16.04.2010, 10:27
[size=10pt]hey guys m a beginner @ scripting can some1 tell me whats going wrong with my script where m i mistaking
Plz correct me nd help me
i wanna make teams like cops robbers medic civilians etc
nd want to give dem specific colors
bt whn i run the script all it gives is white to every one
heres the script [/size]
Plz correct me nd help me
i wanna make teams like cops robbers medic civilians etc
nd want to give dem specific colors
bt whn i run the script all it gives is white to every one
![Sad](images/smilies/sad.gif)
heres the script [/size]
Код:
#include <a_samp> // This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT //Colors #define COLOR_WHITE 0xFFFFFFFF #define COLOR_YELLOW 0xFFFF00AA #define COLOR_ORANGE 0xFF9900AA #define COLOR_BLUE 0x0000BBAA #define COLOR_VIOLET 0x9955DEEE #define TEAM_CIVILIAN 0 #define TEAM_FBI 1 #define TEAM_COPMED 2 // Cops medic #define TEAM_COPAD 3 // Cops arms dealer #define TEAM_ARMY 4 #define TEAM_SECRET 5 // Secret service #define TEAM_COP 6 #define TEAM_SWAT 7 //Team Colors #define TEAM_FBI_COLOR 0x9955DEEE #define TEAM_COPMED_COLOR 0x0000BBAA #define TEAM_COPAD_COLOR 0x0000BBAA #define TEAM_ARMY_COLOR 0x0000BBAA #define TEAM_COP_COLOR 0x0000BBAA #define TEAM_SECRET_COLOR 0x9955DEEE #define TEAM_SWAT_COLOR 0x0000BBAA #define TEAM_CIVILIAN_COLOR 0xFFFFFFFF #define MAX_STRING 255 //New's new CIVILIAN[MAX_PLAYERS]; new FBI[MAX_PLAYERS]; new COPMED[MAX_PLAYERS]; new COPAD[MAX_PLAYERS]; new ARMY[MAX_PLAYERS]; new SECRET[MAX_PLAYERS]; new SWAT[MAX_PLAYERS]; new COP[MAX_PLAYERS]; new gTeam[MAX_PLAYERS]; new ArmorPickup; new M4Pickup; new HealthPickup; new ShotgunPickup; new Float:health; new Float:Armor; new Float:RandomSpawn[][4] = { // Positions, (X, Y, Z and Facing Angle) {1481.4875,-1624.8771,14.0469,358.1432}, {1177.6996,-1323.9449,14.0836,264.3672}, {1259.7723,-1267.5343,13.4294,349.2813} }; //forwards forward IsPlayerJob(playerid); forward SetPlayerTeamFromClass(playerid, classid); forward SetPlayerToTeamColor(playerid); #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Peter's Beta"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n----------------------------------"); print(" Peter's Beta"); print("----------------------------------\n"); } #endif public IsPlayerJob(playerid) if(CIVILIAN[playerid] == 1) { return 1; } else if(FBI[playerid] == 2) { return 2; } else if(COPMED[playerid] == 3) { return 3; } else if(COPAD[playerid] == 4) { return 4; } else if(ARMY[playerid] == 5) { return 5; } else if(SECRET[playerid] == 6) { return 6; } else if(COP[playerid] == 7) { return 7; } else if(SWAT[playerid] == 8) { return 8; } else { return 0; } SetPlayerTeamFromClass(playerid, classid) { if (classid == 0 || 1 || 2 || 3) { gTeam[playerid] = TEAM_COPMED; } if (classid == 4 || 5 || 6) { gTeam[playerid] = TEAM_FBI; } if (classid == 7 || 8) { gTeam[playerid] = TEAM_SECRET; } if (classid == 9 || 10 || 11) { gTeam[playerid] = TEAM_COP; } if (classid == 12 || 13) { gTeam[playerid] = TEAM_SWAT; } if (classid == 14) { gTeam[playerid] = TEAM_ARMY; } if (classid == 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22) { gTeam[playerid] = TEAM_CIVILIAN; } if (classid == 23) { gTeam[playerid] = TEAM_COPAD; } return false; } SetPlayerToTeamColor(playerid) { if (gTeam[playerid] == TEAM_CIVILIAN) { SetPlayerColor(playerid, TEAM_CIVILIAN_COLOR); } if (gTeam[playerid] == TEAM_SWAT) { SetPlayerColor(playerid, TEAM_SWAT_COLOR); } if (gTeam[playerid] == TEAM_FBI) { SetPlayerColor(playerid, TEAM_FBI_COLOR); } if (gTeam[playerid] == TEAM_COPMED) { SetPlayerColor(playerid, TEAM_COPMED_COLOR); } if (gTeam[playerid] == TEAM_COPAD) { SetPlayerColor(playerid, TEAM_COPAD_COLOR); } if (gTeam[playerid] == TEAM_ARMY) { SetPlayerColor(playerid, TEAM_ARMY_COLOR); } if (gTeam[playerid] == TEAM_COP) { SetPlayerColor(playerid, TEAM_COP_COLOR); } if (gTeam[playerid] == TEAM_SECRET) { SetPlayerColor(playerid, TEAM_SECRET_COLOR); } } public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Peter's script"); // [class selection] //Cops Skins AddPlayerClassEx(TEAM_COPMED,71,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,0,0); // [cop medic 1] AddPlayerClassEx(TEAM_COPMED,276,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,0,0); // [cop medic 2] AddPlayerClassEx(TEAM_COPMED,274,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,0,0); // [cop medic 3] AddPlayerClassEx(TEAM_COPMED,275,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,0,0); // [cop medic 4] AddPlayerClassEx(TEAM_FBI,163,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,0,0); // [FBI 1] AddPlayerClassEx(TEAM_FBI,164,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,0,0); // [FBI 2] AddPlayerClassEx(TEAM_FBI,286,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,0,0); // [FBI 3] AddPlayerClassEx(TEAM_SECRET,165,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,0,0); // [Secret Service] AddPlayerClassEx(TEAM_SECRET,166,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,0,0); // [Secret Service] AddPlayerClassEx(TEAM_COP,280,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,25,50); // [cop 1] AddPlayerClassEx(TEAM_COP,281,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,25,50); // [cop 2] AddPlayerClassEx(TEAM_COP,283,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,25,50); // [cop 3] AddPlayerClassEx(TEAM_SWAT,284,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,29,200); // [S.W.A.T 1] AddPlayerClassEx(TEAM_SWAT,285,-2687.5405,1431.5968,906.4609,178.0720,3,0,24,200,29,200); // [S.W.A.T 2] AddPlayerClassEx(TEAM_ARMY,287,-2687.5405,1431.5968,906.4609,178.0720,4,0,24,200,31,200); // [Army Man] // Civilian Skins AddPlayerClassEx(TEAM_CIVILIAN,23,-2687.5405,1431.5968,906.4609,178.0720,0,0,0,0,0,0); // AddPlayerClassEx(TEAM_CIVILIAN,29,-2687.5405,1431.5968,906.4609,178.0720,0,0,0,0,0,0); // AddPlayerClassEx(TEAM_CIVILIAN,46,-2687.5405,1431.5968,906.4609,178.0720,0,0,0,0,0,0); // AddPlayerClassEx(TEAM_CIVILIAN,59,-2687.5405,1431.5968,906.4609,178.0720,0,0,0,0,0,0); // AddPlayerClassEx(TEAM_CIVILIAN,60,-2687.5405,1431.5968,906.4609,178.0720,0,0,0,0,0,0); // AddPlayerClassEx(TEAM_CIVILIAN,122,-2687.5405,1431.5968,906.4609,178.0720,0,0,0,0,0,0); // AddPlayerClassEx(TEAM_CIVILIAN,170,-2687.5405,1431.5968,906.4609,178.0720,0,0,0,0,0,0); // AddPlayerClassEx(TEAM_CIVILIAN,180,-2687.5405,1431.5968,906.4609,178.0720,0,0,0,0,0,0); // // arms dealer AddPlayerClassEx(TEAM_COPAD,179,-2687.5405,1431.5968,906.4609,178.0720,0,0,0,0,0,0); // //cars AddStaticVehicle(478,1245.9495,-1267.5419,13.4303,359.2184,40,1); // AddStaticVehicle(524,1247.6648,-1257.4795,14.0656,268.1412,61,27); // //hospital AddStaticVehicle(416,1177.6389,-1308.2184,14.0156,268.9109,1,3); // AddStaticVehicle(416,1178.3356,-1340.0011,14.0466,269.9932,1,3); // AddStaticVehicle(416,1183.0634,-1332.3435,13.7294,359.4125,1,3); // AddStaticVehicle(416,1182.6093,-1315.6161,13.7234,180.5695,1,3); // //LSPD AddStaticVehicle(596,1534.6953,-1644.9620,5.6108,179.6305,0,1); // [cop car] AddStaticVehicle(596,1570.4349,-1710.8486,5.6121,359.3484,0,1); // [cop car] AddStaticVehicle(596,1587.4266,-1711.1724,5.6122,359.1718,0,1); // [cop car] AddStaticVehicle(596,1602.0538,-1684.0597,5.6103,90.7180,0,1); // [cop car] AddStaticVehicle(596,1545.5614,-1659.0649,5.6126,88.5464,0,1); // [cop car] AddStaticVehicle(596,1602.1031,-1700.1478,5.6119,89.8305,0,1); // [cop car] AddStaticVehicle(599,1602.3721,-1691.8568,6.0806,87.7838,0,1); // [cop crusier] AddStaticVehicle(599,1578.6476,-1711.4980,6.0816,358.5701,0,1); // [cop crusier] AddStaticVehicle(599,1595.5505,-1711.5095,6.0755,0.4109,0,1); // [cop crusier] AddStaticVehicle(599,1528.1201,-1683.8990,6.0798,271.5725,0,1); // [cop crusier] AddStaticVehicle(599,1545.6427,-1667.7758,6.0801,90.1865,0,1); // [cop crusier] AddStaticVehicle(596,1546.2009,-1684.3910,5.6616,88.6632,0,0); // [cop car] AddStaticVehicle(541,1546.0634,-1676.1952,5.5157,86.7241,0,0); // [cop bullet] AddStaticVehicle(451,1546.0295,-1680.3895,5.5966,88.8107,0,0); // [cop turismo] AddStaticVehicle(470,1545.7699,-1654.9562,5.8833,90.8350,43,0); // [army truck] AddStaticVehicle(470,1602.1589,-1695.9434,5.8828,91.3354,43,0); // [army truck] AddStaticVehicle(528,1584.6487,-1671.9106,5.9385,269.1833,4,0); // [FBI truck] AddStaticVehicle(490,1585.2466,-1667.9063,6.0205,270.7188,0,0); // [FBI Ranch] AddStaticVehicle(427,1602.8806,-1628.4861,13.6284,87.8776,0,1); // [cop enforcer] AddStaticVehicle(427,1602.8265,-1606.4724,13.6264,89.3115,0,1); // [cop enforcer] AddStaticVehicle(427,1578.6692,-1607.3442,13.5147,177.9367,0,1); // [cop enforcer] AddStaticVehicle(432,1602.2526,-1618.6749,13.4998,88.7411,43,0); // [army rhino] AddStaticVehicle(433,1584.9459,-1608.0205,13.8195,181.3521,43,0); // [army Barracks] AddStaticVehicle(523,1561.8154,-1708.0593,5.4620,0.1353,0,0); // [Cop bike] AddStaticVehicle(523,1563.6760,-1708.0686,5.4613,354.1099,0,0); // [Cop bike] AddStaticVehicle(523,1565.5098,-1708.1105,5.4613,359.2512,0,0); // [Cop bike] AddStaticVehicle(523,1562.0127,-1713.0522,5.4588,1.2095,0,0); // [Cop bike] AddStaticVehicle(523,1563.7205,-1713.0278,5.4597,1.9374,0,0); // [Cop bike] AddStaticVehicle(523,1565.4626,-1713.0309,5.4608,359.9368,0,0); // [Cop bike] AddStaticVehicle(523,1567.5712,-1713.0962,5.4614,358.0910,0,0); // [Cop bike] AddStaticVehicle(523,1567.5201,-1708.1367,5.4601,0.1465,0,0); // [Cop bike] AddStaticVehicle(596,1545.4962,-1662.9818,5.6109,86.3283,0,1); // [Cop car] AddStaticVehicle(596,1530.4626,-1644.8174,5.6119,180.5410,0,1); // [Cop car] AddStaticVehicle(601,1583.3624,-1711.1196,5.6494,0.1033,1,1); // [S.W.A.T Van] AddStaticVehicle(601,1603.1667,-1612.0016,13.2583,90.3091,1,1); // [S.W.A.T Van] AddStaticVehicle(425,1552.9619,-1610.3612,13.5656,87.2675,0,0); // [Cops heli] AddStaticVehicle(520,2002.0978,-2643.4519,14.2701,356.0902,0,0); // hydra AddStaticVehicle(520,1976.6053,-2649.1611,14.2701,360.0000,0,0); // hydra DisableInteriorEnterExits(); SetNameTagDrawDistance(15.0); ShowPlayerMarkers(2); //Pickups for cops ArmorPickup = CreatePickup(1242,2,1557.0894,-1691.4363,5.8970); M4Pickup = CreatePickup(356,15,1557.4009,-1695.5192,5.8970); HealthPickup = CreatePickup(1240,15,1561.3501,-1695.5967,5.8970); ShotgunPickup = CreatePickup(349,15,1561.7139,-1691.5551,5.8906); // This will allow weapons inside interiors. AllowInteriorWeapons(1); return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { if(pickupid == M4Pickup) { GivePlayerWeapon(playerid, 31, 200); ApplyAnimation(playerid,"COLT45","colt45_reload",2.0,0,1,1,1,1); PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0); GameTextForPlayer(playerid, "~w~ You Picked Up ~n~ ~g~ Maverick", 3000, 3); } if(pickupid == ShotgunPickup) { GivePlayerWeapon(playerid, 25, 100); ApplyAnimation(playerid,"MISC","pickup_box",2.0,0,1,1,1,1); PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0); GameTextForPlayer(playerid, "~w~ You Picked Up ~n~ ~g~ shotgun", 3000, 3); } if(pickupid == HealthPickup) { GetPlayerHealth(playerid,health); if(health < 100) { SetPlayerHealth(playerid, 100.0); ApplyAnimation(playerid,"MISC","pickup_box",2.0,0,1,1,1,1); PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0); GameTextForPlayer(playerid, "~w~ You Picked Up ~n~ ~g~ Health Pack", 3000, 3); } if(health == 100) { GameTextForPlayer(playerid, "~r~ You Don't Need This ~n~ ~r~ Health Pack", 3000, 3); } } if(pickupid == ArmorPickup) { GetPlayerArmour(playerid,Armor); if(Armor < 100) { SetPlayerArmour(playerid, 100.0); ApplyAnimation(playerid,"MISC","pickup_box",2.0,0,1,1,1,1); PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0); GameTextForPlayer(playerid, "~w~ You Picked Up ~n~ ~g~ Armor", 3000, 3); } if(Armor == 100) { GameTextForPlayer(playerid, "~r~ You Already Have Full ~n~ ~r~ Armor", 3000, 3); } } else { return 0; } return 0; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerTeamFromClass(playerid, classid); SetPlayerInterior(playerid,3); PlayerPlaySound(playerid,1186,0,0,0); SetPlayerFacingAngle(playerid,178.0720); SetPlayerPos(playerid,-2687.5405,1431.5968,906.4609); SetPlayerCameraPos(playerid,-2687.7866,1427.6306,906.4609); SetPlayerCameraLookAt(playerid,-2687.5405,1431.5968,906.4609); switch (classid) { case 0: { GameTextForPlayer(playerid, "~w~Citizen",500, 3); if(IsPlayerJob(playerid) == 1) { GameTextForPlayer(playerid, "~w~ Civilian~n~ ~n~ ~n~ ~n~ ~n~ ~g~ Available for you", 900, 3); return 1; } else { GameTextForPlayer(playerid, "~w~ Civilian~n~ ~n~ ~n~ ~n~ ~n~ ~r~ Not available for you", 900, 3); return 1; } } case 1: { GameTextForPlayer(playerid, "~b~ FBI",900, 3); if(IsPlayerJob(playerid) == 2) { GameTextForPlayer(playerid, "~b~ FBI ~n~ ~n~ ~n~ ~n~ ~n~ ~g~ Available for you", 900, 3); return 1; } else { GameTextForPlayer(playerid, "~b~ FBI ~n~ ~n~ ~n~ ~n~ ~n~ ~r~ Not available for you", 900, 3); return 1; } } case 2: { GameTextForPlayer(playerid, "~b~Medic Cop",900, 3); if(IsPlayerJob(playerid) == 3) { GameTextForPlayer(playerid, "~b~Medic cop ~n~ ~n~ ~n~ ~n~ ~n~ ~g~ Available for you", 900, 3); return 1; } else { GameTextForPlayer(playerid, "~b~Medic cop ~n~ ~n~ ~n~ ~n~ ~n~ ~r~ Not available for you", 900, 3); return 1; } } case 3: { GameTextForPlayer(playerid, "~b~ Cops Arms Dealer",5000, 6); if(IsPlayerJob(playerid) == 4) { GameTextForPlayer(playerid, "~b~ Cops Arms Dealer ~n~ ~n~ ~n~ ~n~ ~n~ ~g~ Available for you", 900, 3); return 1; } else { GameTextForPlayer(playerid, "~b~ Cops Arms Dealer ~n~ ~n~ ~n~ ~n~ ~n~ ~r~ Not available for you", 900, 3); return 1; } } case 4: { GameTextForPlayer(playerid, "~b~ Army Man",2000, 3); if(IsPlayerJob(playerid) == 5) { GameTextForPlayer(playerid, "~b~ Army Man ~n~ ~n~ ~n~ ~n~ ~n~ ~g~ Available for you", 900, 3); return 1; } else { GameTextForPlayer(playerid, "~b~ Army Man ~n~ ~n~ ~n~ ~n~ ~n~ ~r~ Not available for you", 900, 3); return 1; } } case 5: { GameTextForPlayer(playerid, "~p~ Secret Service",900, 3); if(IsPlayerJob(playerid) == 6) { GameTextForPlayer(playerid, "~p~ Secret Service ~n~ ~n~ ~n~ ~n~ ~n~ ~g~ Available for you", 900, 3); return 1; } else { GameTextForPlayer(playerid, "~p~ Secret Service ~n~ ~n~ ~n~ ~n~ ~n~ ~r~ Not available for you", 900, 3); return 1; } } case 6: { GameTextForPlayer(playerid, "~b~Cop",2000, 3); if(IsPlayerJob(playerid) == 7) { GameTextForPlayer(playerid, "~b~Cop ~n~ ~n~ ~n~ ~n~ ~n~ ~g~ Available for you", 900, 3); return 1; } else { GameTextForPlayer(playerid, "~b~Cop ~n~ ~n~ ~n~ ~n~ ~n~ ~r~ Not available for you", 900, 3); return 1; } } case 7: { GameTextForPlayer(playerid, "~p~ S.W.A.T",900, 6); if(IsPlayerJob(playerid) == 8) { GameTextForPlayer(playerid, "~p~ S.W.A.T ~n~ ~n~ ~n~ ~n~ ~n~ ~g~ Available for you", 900, 3); return 1; } else { GameTextForPlayer(playerid, "~p~ S.W.A.T ~n~ ~n~ ~n~ ~n~ ~n~ ~r~ Not available for you", 900, 3); return 1; } } } return 1; } public OnPlayerRequestSpawn(playerid) { return 1; } public OnPlayerConnect(playerid) { new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"%s has joined the server. Welcome!",pName); SendClientMessageToAll(0xFFFFFFAA,string); return 1; } public OnPlayerDisconnect(playerid, reason) { new string[64], name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,MAX_PLAYER_NAME); switch(reason) { case 0: format(string,sizeof string,"%s left the server. (Timed out)",name); case 1: format(string,sizeof string,"%s left the server. (Leaving)",name); case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name); } SendClientMessageToAll(0xFFFFFFAA,string); return 1; } public OnPlayerSpawn(playerid) { SetPlayerToTeamColor(playerid); SetPlayerInterior(playerid,0); { new iRandom = random(sizeof(RandomSpawn)); // SetPlayerPos to the random spawn information SetPlayerPos(playerid, RandomSpawn[iRandom][0], RandomSpawn[iRandom][1],RandomSpawn[iRandom][2]); SetPlayerFacingAngle(playerid, RandomSpawn[iRandom][3]); return 1; } } public OnPlayerDeath(playerid, killerid, reason) { SendDeathMessage(killerid, playerid, reason); return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerPrivmsg(playerid, recieverid, text[]) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/help", cmdtext, true, 10) == 0) { SendClientMessage(playerid, 0x33AA33AA, "Welcome to my servers Bhosdike this is beta version!"); return 1; } return 0; } public OnPlayerInfoChange(playerid) { 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 OnObjectMoved(objectid) { return 1; } public OnPlayerObjectMoved(playerid, objectid) { return 1; } public OnPlayerSelectedMenuRow(playerid, row) { return 1; } public OnPlayerExitedMenu(playerid) { return 1; }