26.01.2011, 08:30
I had a post and there were lots of warnings in it because i copied some scripts from other gamemodes.
https://sampforum.blast.hk/showthread.php?pid=1032975#pid1032975
And now my script are fixed.no errors or warnings but the problem's still here.Here's my problem.
I can't work my random team player spawn's selection and i don't know why.
for example no matter i choose team a or b,i still spawn in "AddPlayerClass" position.
And if i change"else if(gTeam[playerid] == TEAM_400K)" to just "else" (in OnPlayerSpawn)
no matter i choose team a or b,i spawn in random team b's area (spawn in b's area=in "else" 's selection)
SO i think i might do something wrong on my team select,but i don't know what i did was wrong.
please help me and here's the code,thanks!!
my team's names may be a bit strange because their sound's like cantonese names.
https://sampforum.blast.hk/showthread.php?pid=1032975#pid1032975
And now my script are fixed.no errors or warnings but the problem's still here.Here's my problem.
I can't work my random team player spawn's selection and i don't know why.
for example no matter i choose team a or b,i still spawn in "AddPlayerClass" position.
And if i change"else if(gTeam[playerid] == TEAM_400K)" to just "else" (in OnPlayerSpawn)
no matter i choose team a or b,i spawn in random team b's area (spawn in b's area=in "else" 's selection)
SO i think i might do something wrong on my team select,but i don't know what i did was wrong.
please help me and here's the code,thanks!!
Код:
// This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT #include <a_samp> #include <core> #include <float> #include "../include/gl_common.inc" #define TEAM_NEWBEYOND 1 #define TEAM_400K 2 #define TEAM_NEWBEYOND_COLOR 0x00FF00AA // Bright Green (in RGBA format) 0 #define TEAM_400K_COLOR 0xFF00FFAA // Bright Purple 126 new total_vehicles_from_files=0; new Float:gNewbeyondSpawns[][4] ={ {2460.3081,-1715.6678,13.5400,177.4539}, {2447.0830,-1689.2539,13.5199,128.7327}, {2461.2871,-1637.8500,13.4250,30.0109}, {2478.2070,-1642.8694,13.4509,1.9073}, {2513.5608,-1638.6272,14.1400,313.5020}, {2525.1946,-1650.8152,14.4580,318.7791}, {2538.5913,-1668.5663,15.1574,266.6921}, {2530.6399,-1689.8724,13.8194,252.4563}, {2522.5918,-1700.5239,17.8584,44.4754}, {2493.7568,-1694.5708,23.4752,177.7178}}; new Float:g400KSpawns[][4] = { {305.1188,-1762.3278,7.6797,27.0282}, {261.3995,-1760.3229,12.4531,35.2505}, {308.7643,-1766.8494,4.5174,353.8223}, {268.7165,-1766.8572,4.7485,65.4644}, {364.4940,-1880.8068,2.6224,148.3876}, {393.3870,-1830.1184,14.7333,263.1954}, {383.5261,-1887.0420,7.8301,227.5352}, {369.6404,-2057.2927,14.6597,185.1653} }; new gTeam[MAX_PLAYERS]; #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blank Filterscript by your name here"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } switch(classid) { case 117..124: gTeam[playerid] = TEAM_NEWBEYOND; case 138..140: gTeam[playerid] = TEAM_400K; //and so on return 1; } SetPlayerToTeamColor(playerid) { if (gTeam[playerid] = TEAM_NEWBEYOND) { SetPlayerColor(playerid, TEAM_NEWBEYOND_COLOR); } else { SetPlayerColor(playerid, TEAM_400K_COLOR); } } #else main() { print("\n----------------------------------"); print(" Blank Gamemode by your name here"); print("----------------------------------\n"); } #endif public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Blank Script"); /*AddPlayerClass(0,2490.6401,-1669.4882,13.3359,98.6257,24,200,30,500,34,100);//CJhome, AddPlayerClass(0,313.1227,-1822.4905,6.4075,0.5103,26,200,29,500,31,500);//Beach */ /////////team 1 AddPlayerClass(117,2490.6401,-1669.4882,13.3359,98.6257,38,300,30,500,9,1); AddPlayerClass(118,2490.6401,-1669.4882,13.3359,98.6257,38,300,30,500,9,1); AddPlayerClass(124,2490.6401,-1669.4882,13.3359,98.6257,38,300,30,500,9,1); ///////////team 2 AddPlayerClass(138,2490.6401,-1669.4882,13.3359,98.6257,27,500,29,500,36,3); AddPlayerClass(139,2490.6401,-1669.4882,13.3359,98.6257,27,500,29,500,36,3); AddPlayerClass(140,2490.6401,-1669.4882,13.3359,98.6257,27,500,29,500,36,3); ///////////// AddStaticVehicle(522,2512.3889,-1686.7402,13.1382,45.4348,-1,-1); // bikes nrg-500 AddStaticVehicle(522,2511.7117,-1688.1616,13.1398,49.9653,-1,-1); // bikes nrg-500 AddStaticVehicle(522,2510.8943,-1689.7732,13.0944,53.0169,-1,-1); // bikes nrg-500 AddStaticVehicle(451,2516.1394,-1673.9448,13.6207,79.6050,-1,-1); // car Turismo AddStaticVehicle(451,2516.5786,-1670.5096,13.6215,90.0174,-1,-1); // car Turismo AddStaticVehicle(451,2516.2146,-1665.9780,13.5699,101.5529,-1,-1); // car Turismo AddStaticVehicle(547,2505.8440,-1661.7810,13.1425,36.6248,-1,-1); // car 4man AddStaticVehicle(547,2499.4836,-1656.5259,13.1306,64.9908,-1,-1); // car 4man AddStaticVehicle(578,2492.3657,-1655.2960,13.1052,86.5801,-1,-1); // Industrial AddStaticVehicle(487,2483.7295,-1668.7384,13.5118,89.7824,-1,-1); // Helicopters 4man AddStaticVehicle(487,346.5114,-1826.4482,4.0971,359.2811,-1,-1); // Helicopters 4man AddStaticVehicle(506,343.8145,-1809.6776,4.2141,359.5804,-1,-1); // car superGT AddStaticVehicle(506,340.8044,-1809.6555,4.2136,0.6929,-1,-1); // car superGT AddStaticVehicle(506,337.3299,-1809.6398,4.2029,0.3508,-1,-1); // car superGT AddStaticVehicle(521,320.6433,-1809.9333,4.0360,52.0289,-1,-1); // bikes fcr900 AddStaticVehicle(521,324.4290,-1809.7444,4.0438,43.9813,-1,-1); // bikes fcr900 AddStaticVehicle(521,328.8616,-1810.8387,4.0233,32.6748,-1,-1); // bikes fcr900 AddStaticVehicle(490,324.6275,-1789.2450,4.9084,181.2155,0,0); // car FBI 4man AddStaticVehicle(468,384.2514,-2069.5911,7.4984,31.1351,46,46); // bike AddStaticVehicle(468,379.1796,-2064.0400,7.5054,17.9207,46,46); // bike AddStaticVehicle(468,390.9801,-2057.1340,7.5054,348.2943,46,46); // bike AddStaticVehicle(468,387.4541,-2050.0874,7.5054,24.4321,46,46); // bike AddStaticVehicle(468,381.3913,-2043.4966,7.5046,36.3517,46,46); // bike AddStaticVehicle(468,380.9457,-2035.2592,7.5020,21.6519,46,46); // bike AddStaticVehicle(468,381.4726,-2030.7108,7.5028,26.9677,46,46); // bike AddStaticVehicle(468,380.7545,-2025.2583,7.5039,26.6538,46,46); // bike AddStaticVehicle(468,376.8941,-1990.6498,7.5053,357.2064,46,46); // bike AddStaticVehicle(468,377.2444,-1961.0939,7.5054,359.5827,46,46); // bike AddStaticVehicle(468,377.4824,-1928.4324,7.4994,359.5806,46,46); // bike AddStaticVehicle(468,377.2329,-1908.1506,7.5058,8.2248,46,46); // bike AddStaticVehicle(468,386.9855,-1899.7078,7.5043,16.5199,46,46); // bike AddStaticVehicle(468,384.9941,-1896.1218,7.5033,32.2371,46,46); // bike AddStaticVehicle(468,381.0583,-1865.9172,7.5054,4.4324,46,46); // bike AddStaticVehicle(468,381.5878,-1854.6010,7.5034,16.1975,46,46); // bike AddStaticVehicle(468,378.9889,-1838.2413,7.5053,23.8915,46,46); // bike AddStaticVehicle(468,381.8762,-1823.8490,7.5030,49.2962,46,46); // bike AddStaticVehicle(468,381.4466,-1813.1875,7.4995,55.1148,46,46); // bike AddStaticVehicle(468,376.9450,-1801.3772,7.5824,31.9841,46,46); // bike //////////////////////////////////////////////////////////////////////////////////// // LOS SANTOS /////////////////////////////////////////////////////////////////////////////////// total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/1.txt"); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid,2490.6401,-1669.4882,13.3359); SetPlayerCameraPos(playerid,2491.6402,-1670.4882,13.3359); SetPlayerCameraLookAt(playerid,2490.6401,-1669.4882,13.3359); return 1; } public OnPlayerConnect(playerid) { return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) { if(gTeam[playerid] == TEAM_NEWBEYOND) { new newbeyondspawn = random(sizeof(gNewbeyondSpawns)); SetPlayerPos(playerid,gNewbeyondSpawns[newbeyondspawn][0],gNewbeyondSpawns[newbeyondspawn][1],gNewbeyondSpawns[newbeyondspawn][2]); SetPlayerFacingAngle(playerid,gNewbeyondSpawns[newbeyondspawn][3]); SetPlayerColor(playerid, TEAM_NEWBEYOND_COLOR); SetPlayerHealth(playerid,100.0); SetPlayerArmour(playerid,200.0); GivePlayerMoney(playerid,1000); } else if(gTeam[playerid] == TEAM_400K) { new fkspawn = random(sizeof(g400KSpawns)); SetPlayerPos(playerid,g400KSpawns[fkspawn][0],g400KSpawns[fkspawn][1],g400KSpawns[fkspawn][2]); SetPlayerFacingAngle(playerid,g400KSpawns[fkspawn][3]); SetPlayerColor(playerid,TEAM_400K_COLOR); SetPlayerHealth(playerid,100.0); SetPlayerArmour(playerid,200.0); GivePlayerMoney(playerid,1000); } 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) { 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; }