16.01.2013, 07:28
Estou com um problema, a funзгo GivePlayerWeapon nгo estб funcionando. Jб tentei de tudo, ai estб meu GameMode:
(A funзгo que eu estou com problemas estб na public OnDialogResponse)
Vou explicar melhor, por exemplo: Quando o jogador digite algum comando que tenha o GivePlayerWeapon todos as outras funзхes do comando funcionam menos GivePlayerWeapon, й como se ele nгo estivesse no cуdigo. Ajudem!!
(A funзгo que eu estou com problemas estб na public OnDialogResponse)
Код:
#include <a_samp> #include <streamer> #include <cpstream> #include <dini> #define SlotAKeFUZIL 1 #define SlotEscopeta 2 #define COLOR_HPBAR_BG 0x000000FF #define COLOR_HPBAR_75100BG 0x128200AA #define COLOR_HPBAR_75100 0x1ED500FF #define COLOR_HPBAR_5075BG 0xB8BA00AA #define COLOR_HPBAR_5075 0xFCFF00FF #define COLOR_HPBAR_2550BG 0xB17103AA #define COLOR_HPBAR_2550 0xFFA200FF #define COLOR_BRANCO 0xFFFFFFFF #define COLOR_AMARELO 0xFFFF00FF #define COLOR_VERMELHO 0xFF0000FF #define COLOR_VERDE 0x00FF00FF #define COLOR_AMERICANOS 0x86E3A8FF #define COLOR_CHINESES 0xF26363FF #define COLOR_CONNECT 0x9AB3D6FF #if defined FILTERSCRIPT #else main() { print("\n----------------------------------"); print(" GameMode inicializado com кxito! "); print("----------------------------------\n"); } #endif forward DesligarCameraAssasino(playerid); new Checkpoint_Americanos; new Text:BoasVindas; new Text:TextoVendoAssasino; new Text:HealthBar[19]; new bool:LaserLigado[MAX_PLAYERS] = true; new bool:VendoAssasino[MAX_PLAYERS]; new bool:AcabouDeNascer[MAX_PLAYERS]; new Float:AmericanosPos[][4] = { {1288.4000,1308.5504,10.8203,272.0447}, {1361.1674,1275.4858,10.8203,87.0720}, {1315.7972,1272.4785,10.9766,1.0323}}; public OnGameModeInit() { SetGameModeText("BF 1.0 - TDM"); UsePlayerPedAnims(); if(!fexist("dinheiro.ini")) dini_Create("dinheiro.ini"); if(!fexist("score.ini")) dini_Create("score.ini"); AddPlayerClass(285, 1958.33, 1343.12, 15.36, 269.15, 24, 50, 0, 0, 0, 0); AddPlayerClass(287, 1958.33, 1343.12, 15.36, 269.15, 24, 50, 0, 0, 0, 0); AddPlayerClass(191, 1958.33, 1343.12, 15.36, 269.15, 24, 50, 0, 0, 0, 0); AddPlayerClass(179, 1958.33, 1343.12, 15.36, 269.15, 24, 50, 0, 0, 0, 0); BoasVindas = TextDrawCreate(236.000000, 343.000000, "~r~Battlefield Server"); TextDrawBackgroundColor(BoasVindas, 0x000000AA); TextDrawFont(BoasVindas, 3); TextDrawLetterSize(BoasVindas, 0.769999, 2.599998); TextDrawColor(BoasVindas, 0xFFFFFFAA); TextDrawSetOutline(BoasVindas, 0); TextDrawSetProportional(BoasVindas, 1); TextDrawSetShadow(BoasVindas, 1); TextoVendoAssasino = TextDrawCreate(44, 291, "~w~Para nascer aguarde 10 segundos ou pressione o ~b~CLIQUE ESQUERDO DO MOUSE~w~..."); TextDrawFont(TextoVendoAssasino, 2); TextDrawLetterSize(TextoVendoAssasino, 0.3, 1.4); TextDrawColor(TextoVendoAssasino, 0xff0000FF); TextDrawSetOutline(TextoVendoAssasino, false); TextDrawSetProportional(TextoVendoAssasino, true); TextDrawSetShadow(TextoVendoAssasino, 1); new p = GetMaxPlayers(); for (new i=0; i < p; i++) { SetPVarInt(i, "laser", 0); SetPVarInt(i, "color", 18643); } Checkpoint_Americanos = CPS_AddCheckpoint(1316.2965, 1268.3882, 10.8203, 2.0, 200); HealthBar[0] = TextDrawCreate(611.0,68.5,"_"); TextDrawLetterSize(HealthBar[0],0.5,0.449999); TextDrawUseBox(HealthBar[0],1); TextDrawBoxColor(HealthBar[0],COLOR_HPBAR_BG); TextDrawTextSize(HealthBar[0],543.0,0.0); HealthBar[1] = TextDrawCreate(608.5,71.0,"_"); TextDrawLetterSize(HealthBar[1],0.5,0.0); TextDrawUseBox(HealthBar[1],1); TextDrawBoxColor(HealthBar[1],COLOR_HPBAR_75100BG); TextDrawTextSize(HealthBar[1],545.0,0.0); HealthBar[2] = TextDrawCreate(609.0,71.0,"_"); TextDrawLetterSize(HealthBar[2],0.5,0.0); TextDrawUseBox(HealthBar[2],1); TextDrawBoxColor(HealthBar[2],COLOR_HPBAR_75100); TextDrawTextSize(HealthBar[2],545.0,0.0); HealthBar[3] = TextDrawCreate(604.0,71.0,"_"); TextDrawLetterSize(HealthBar[3],0.5,0.0); TextDrawUseBox(HealthBar[3],1); TextDrawBoxColor(HealthBar[3],COLOR_HPBAR_75100); TextDrawTextSize(HealthBar[3],545.0,0.0); HealthBar[4] = TextDrawCreate(601.0,71.0,"_"); TextDrawLetterSize(HealthBar[4],0.5,0.0); TextDrawUseBox(HealthBar[4],1); TextDrawBoxColor(HealthBar[4],COLOR_HPBAR_75100); TextDrawTextSize(HealthBar[4],545.0,0.0); HealthBar[5] = TextDrawCreate(598.0,71.0,"_"); TextDrawLetterSize(HealthBar[5],0.5,0.0); TextDrawUseBox(HealthBar[5],1); TextDrawBoxColor(HealthBar[5],COLOR_HPBAR_75100); TextDrawTextSize(HealthBar[5],545.0,0.0); HealthBar[6] = TextDrawCreate(595.0,71.0,"_"); TextDrawLetterSize(HealthBar[6],0.5,0.0); TextDrawUseBox(HealthBar[6],1); TextDrawBoxColor(HealthBar[6],COLOR_HPBAR_75100); TextDrawTextSize(HealthBar[6],545.0,0.0); HealthBar[7] = TextDrawCreate(608.5,71.0,"_"); TextDrawLetterSize(HealthBar[7],0.5,0.0); TextDrawUseBox(HealthBar[7],1); TextDrawBoxColor(HealthBar[7],COLOR_HPBAR_5075BG); TextDrawTextSize(HealthBar[7],545.0,0.0); HealthBar[8] = TextDrawCreate(591.5,71.0,"_"); TextDrawLetterSize(HealthBar[8],0.5,0.0); TextDrawUseBox(HealthBar[8],1); TextDrawBoxColor(HealthBar[8],COLOR_HPBAR_5075); TextDrawTextSize(HealthBar[8],545.0,0.0); HealthBar[9] = TextDrawCreate(588.5,71.0,"_"); TextDrawLetterSize(HealthBar[9],0.5,0.0); TextDrawUseBox(HealthBar[9],1); TextDrawBoxColor(HealthBar[9],COLOR_HPBAR_5075); TextDrawTextSize(HealthBar[9],545.0,0.0); HealthBar[10] = TextDrawCreate(585.5,71.0,"_"); TextDrawLetterSize(HealthBar[10],0.5,0.0); TextDrawUseBox(HealthBar[10],1); TextDrawBoxColor(HealthBar[10],COLOR_HPBAR_5075); TextDrawTextSize(HealthBar[10],545.0,0.0); HealthBar[11] = TextDrawCreate(582.5,71.0,"_"); TextDrawLetterSize(HealthBar[11],0.5,0.0); TextDrawUseBox(HealthBar[11],1); TextDrawBoxColor(HealthBar[11],COLOR_HPBAR_5075); TextDrawTextSize(HealthBar[11],545.0,0.0); HealthBar[12] = TextDrawCreate(579.0,71.0,"_"); TextDrawLetterSize(HealthBar[12],0.5,0.0); TextDrawUseBox(HealthBar[12],1); TextDrawBoxColor(HealthBar[12],COLOR_HPBAR_5075); TextDrawTextSize(HealthBar[12],545.0,0.0); HealthBar[13] = TextDrawCreate(608.5,71.0,"_"); TextDrawLetterSize(HealthBar[13],0.5,0.0); TextDrawUseBox(HealthBar[13],1); TextDrawBoxColor(HealthBar[13],COLOR_HPBAR_2550BG); TextDrawTextSize(HealthBar[13],545.0,0.0); HealthBar[14] = TextDrawCreate(576.0,71.0,"_"); TextDrawLetterSize(HealthBar[14],0.5,0.0); TextDrawUseBox(HealthBar[14],1); TextDrawBoxColor(HealthBar[14],COLOR_HPBAR_2550); TextDrawTextSize(HealthBar[14],545.0,0.0); HealthBar[15] = TextDrawCreate(573.0,71.0,"_"); TextDrawLetterSize(HealthBar[15],0.5,0.0); TextDrawUseBox(HealthBar[15],1); TextDrawBoxColor(HealthBar[15],COLOR_HPBAR_2550); TextDrawTextSize(HealthBar[15],545.0,0.0); HealthBar[16] = TextDrawCreate(570.5,71.0, "_"); TextDrawLetterSize(HealthBar[16],0.5,0.0); TextDrawUseBox(HealthBar[16],1); TextDrawBoxColor(HealthBar[16],COLOR_HPBAR_2550); TextDrawTextSize(HealthBar[16],545.0,0.0); HealthBar[17] = TextDrawCreate(567.5,71.0,"_"); TextDrawLetterSize(HealthBar[17],0.5,0.0); TextDrawUseBox(HealthBar[17],1); TextDrawBoxColor(HealthBar[17],COLOR_HPBAR_2550); TextDrawTextSize(HealthBar[17],545.0,0.0); HealthBar[18] = TextDrawCreate(564.0,71.0,"_"); TextDrawLetterSize(HealthBar[18],0.5,0.0); TextDrawUseBox(HealthBar[18],1); TextDrawBoxColor(HealthBar[18],COLOR_HPBAR_2550); TextDrawTextSize(HealthBar[18],545.0,0.0); //AMERICAN'S BASE AddStaticVehicleEx(500,1325.5999756,1279.5000000,11.0000000,0.0000000,16,16,60); //Mesa AddStaticVehicleEx(470,1312.6999512,1279.4000244,10.8999996,0.0000000,16,16,60); //Patriot AddStaticVehicleEx(470,1309.5000000,1279.5000000,10.8999996,0.0000000,16,16,60); //Patriot AddStaticVehicleEx(470,1306.4000244,1279.3000488,10.8999996,0.0000000,16,16,60); //Patriot AddStaticVehicleEx(500,1328.7998047,1279.2998047,11.0000000,0.0000000,16,16,60); //Mesa AddStaticVehicleEx(500,1322.4000244,1279.5000000,11.0000000,0.0000000,16,16,60); //Mesa AddStaticVehicleEx(468,1315.0000000,1278.6999512,10.6000004,0.0000000,16,16,60); //Sanchez AddStaticVehicleEx(468,1318.0999756,1278.5999756,10.6000004,0.0000000,16,16,60); //Sanchez AddStaticVehicleEx(468,1316.8000488,1278.6999512,10.6000004,0.0000000,16,16,60); //Sanchez AddStaticVehicleEx(468,1320.0999756,1278.5000000,10.6000004,0.0000000,16,16,60); //Sanchez AddStaticVehicleEx(476,1277.9000244,1324.3000488,13.0000000,269.8673096,16,16,60); //Rustler AddStaticVehicleEx(476,1277.1999512,1361.5999756,13.0000000,269.8626709,16,16,60); //Rustler AddStaticVehicleEx(548,1296.9000244,1438.5999756,15.8000002,0.0000000,16,16,60); //Cargobob CreateDynamicObject(4874,1313.5999756,1439.4000244,13.3999996,0.0000000,0.0000000,0.0000000); //object(helipad1_las) (1) CreateDynamicObject(980,1706.1999512,1607.5999756,11.5000000,0.0000000,0.0000000,73.7449036); //object(airportgate) (1) CreateDynamicObject(18260,1317.5999756,1263.6999512,11.0000000,0.0000000,0.0000000,0.0000000); //object(crates01) (1) CreateDynamicObject(356,1316.0999756,1265.0999756,11.3999996,84.1659851,302.5291443,54.0583801); //object(11) CreateDynamicObject(2359,1316.3000488,1264.5000000,11.6000004,0.0000000,0.0000000,0.0000000); //object(ammo_box_c5) (2) CreateDynamicObject(2358,1318.5999756,1263.4000244,11.5000000,0.0000000,0.0000000,0.0000000); //object(ammo_box_c2) (1) CreateDynamicObject(2358,1318.5999756,1262.4000244,11.5000000,0.0000000,0.0000000,0.0000000); //object(ammo_box_c2) (2) CreateDynamicObject(2358,1317.8000488,1262.9000244,11.5000000,0.0000000,0.0000000,0.0000000); //object(ammo_box_c2) (3) CreateDynamicObject(1431,1318.3994141,1264.2998047,10.3999996,0.0000000,0.0000000,0.0000000); //object(dyn_box_pile) (2) CreateDynamicObject(1431,1314.1999512,1264.3000488,10.3999996,0.0000000,0.0000000,0.0000000); //object(dyn_box_pile) (3) CreateDynamicObject(1431,1322.4000244,1265.8000488,10.3999996,0.0000000,0.0000000,8.1938782); //object(dyn_box_pile) (4) CreateDynamicObject(7836,1357.6999512,1323.0999756,15.1999998,0.0000000,0.0000000,0.0000000); //object(vegasnfrates09) (1) CreateDynamicObject(7836,1315.4000244,1400.5000000,15.3000002,0.0000000,0.0000000,271.5042725); //object(vegasnfrates09) (2) CreateDynamicObject(8077,1361.5000000,1262.5999756,13.5000000,0.0000000,0.0000000,180.2655487); //object(vgsfrates06) (1) CreateDynamicObject(10814,1296.1999512,1495.0000000,13.3999996,0.0000000,0.0000000,0.0000000); //object(apfuel2_sfse) (1) CreateDynamicObject(10814,1340.6999512,1494.9000244,13.3999996,0.0000000,0.0000000,0.0000000); //object(apfuel2_sfse) (2) CreateDynamicObject(3279,1360.5000000,1282.6999512,9.6999998,0.0000000,0.0000000,0.0000000); //object(a51_spottower) (1) CreateDynamicObject(3279,1274.0999756,1306.3000488,9.6999998,0.0000000,0.0000000,0.0000000); //object(a51_spottower) (2) CreatePickup(1242, 2, 1302.0288,1265.9088,10.8203, -1); return 1; } public OnGameModeExit() { for(new i=0; i<19; i++) { TextDrawHideForAll(HealthBar[i]); TextDrawDestroy(HealthBar[i]); } new p = GetMaxPlayers(); for (new i=0; i < p; i++) { SetPVarInt(i, "laser", 0); RemovePlayerAttachedObject(i, 0); } return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 510.4416,-73.6871,998.7578); SetPlayerCameraPos(playerid, 504.0668,-73.5756,998.7578); SetPlayerCameraLookAt(playerid, 510.4416,-73.6871,998.7578); SetPlayerFacingAngle(playerid, 90.1366); SetPlayerInterior(playerid, 11); ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); TextDrawShowForPlayer(playerid, BoasVindas); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); AcabouDeNascer[playerid] = true; if(GetPlayerSkin(playerid) == 179 || 191 || 287) GameTextForPlayer(playerid,"~n~~n~~n~~g~AMERICANOS", 5000, 5); if(GetPlayerSkin(playerid) == 285) GameTextForPlayer(playerid,"~n~~n~~n~~r~CHINESES", 5000, 5); return 1; } public OnPlayerConnect(playerid) { if(dini_Isset("dinheiro.ini",PlayerName(playerid))) GivePlayerMoney(playerid,dini_Int("dinheiro.ini",PlayerName(playerid))); if(dini_Isset("score.ini",PlayerName(playerid))) SetPlayerScore(playerid,dini_Int("score.ini",PlayerName(playerid))); SetPVarInt(playerid, "color", 18643); SetPVarInt(playerid, "laser", 0); LaserLigado[playerid] = true; new string[200], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"%s [ID: %d] Entrou no combate!",pName,playerid); SendClientMessageToAll(COLOR_CONNECT,string); SendClientMessage(playerid, COLOR_AMARELO, "Bem-vindo ao Battlefield Server, caso nгo saiba como jogar digite: /ajuda"); return 1; } public OnPlayerDisconnect(playerid, reason) { dini_IntSet("dinheiro.ini",PlayerName(playerid),GetPlayerMoney(playerid)); dini_IntSet("score.ini",PlayerName(playerid),GetPlayerScore(playerid)); RemovePlayerAttachedObject(playerid, 0); SetPVarInt(playerid, "laser", 0); return 1; } public OnPlayerSpawn(playerid) { if(LaserLigado[playerid] == true) SetPVarInt(playerid, "laser", 1),SetPVarInt(playerid, "color", GetPVarInt(playerid, "color")); TextDrawHideForPlayer(playerid, BoasVindas); TextDrawShowForPlayer(playerid,HealthBar[0]); SetPlayerInterior(playerid, 0); if(GetPlayerSkin(playerid) == 179 || 191 || 287){ if(AcabouDeNascer[playerid] == true){SendClientMessage(playerid, COLOR_BRANCO, "Vocк entrou na equipe dos Americanos, para ver sua missгo digite: /objetivo"),AcabouDeNascer[playerid] = false,SetPlayerColor(playerid, COLOR_AMERICANOS),SetPlayerTeam(playerid, 1);} new rand = random(sizeof(AmericanosPos)); SetPlayerPos(playerid, AmericanosPos[rand][0], AmericanosPos[rand][1], AmericanosPos[rand][2]); SetPlayerFacingAngle(playerid,AmericanosPos[rand][3]); SetCameraBehindPlayer(playerid);} if(GetPlayerSkin(playerid) == 285){ if(AcabouDeNascer[playerid] == true){ SendClientMessage(playerid, COLOR_BRANCO, "Vocк entrou na equipe dos Chineses, para ver sua missгo digite: /objetivo"),AcabouDeNascer[playerid] = false,SetPlayerTeam(playerid, 2),SetPlayerColor(playerid, COLOR_CHINESES);}} return 1; } public OnPlayerDeath(playerid, killerid, reason) { new string[200], pName[MAX_PLAYER_NAME], kName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME),GetPlayerName(playerid,kName,MAX_PLAYER_NAME); for(new i=0; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); if(killerid == INVALID_PLAYER_ID == true){ format(string,sizeof string,"** %s cometeu suicнdio **",pName); SendClientMessageToAll(COLOR_AMARELO,string);} if(killerid == INVALID_PLAYER_ID == false){ format(string,sizeof string,"** %s exterminou %s **",kName, pName); SendClientMessageToAll(GetPlayerColor(killerid),string); TogglePlayerSpectating(playerid, 1),PlayerSpectatePlayer(playerid, killerid),VendoAssasino[playerid] = true,SetTimerEx("DesligarCameraAssasino", 10000, 0, "iif", playerid),TextDrawShowForPlayer(playerid, TextoVendoAssasino);} return 1; } public OnPlayerText(playerid, text[]) { new output[100]; if(GetPlayerSkin(playerid) == 179 || 191 || 287){ format(output, sizeof(output), "{86E3A8}[ID: %d] %s", playerid, text),SendPlayerMessageToAll(playerid, output);} if(GetPlayerSkin(playerid) == 285){ format(output, sizeof(output), "{F26363}[ID: %d] %s", playerid, text),SendPlayerMessageToAll(playerid, output);} return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[300]; new idx; cmd = strtok(cmdtext, idx); if (!strcmp("/ligarlaser", cmdtext, true)) { if(LaserLigado[playerid] == true) return SendClientMessage(playerid, COLOR_VERMELHO, "O laser jб estб ligado"); LaserLigado[playerid] = true; SetPVarInt(playerid, "laser", 1); SetPVarInt(playerid, "color", GetPVarInt(playerid, "color")); SendClientMessage(playerid, COLOR_VERDE, "Laser ligado"); return 1; } if (!strcmp("/desligarlaser", cmdtext, true)) { if(LaserLigado[playerid] == false) return SendClientMessage(playerid, COLOR_VERMELHO, "Vocк jб desligou o laser"); LaserLigado[playerid] = false; SetPVarInt(playerid, "laser", 0); RemovePlayerAttachedObject(playerid, 0); SendClientMessage(playerid, COLOR_VERDE, "Laser desligado"); return 1; } if (!strcmp("/corlaser", cmd, true)) { new tmp[256]; tmp = strtok(cmdtext, idx); if (!strlen(tmp)) { SendClientMessage(playerid, COLOR_VERMELHO, "Uso correto: /corlaser <cor>"); return 1; } if (!strcmp(tmp, "vermelho", true)) SetPVarInt(playerid, "color", 18643),SendClientMessage(playerid, COLOR_VERDE, "Cor do laser alterada"); else if (!strcmp(tmp, "azul", true)) SetPVarInt(playerid, "color", 19080),SendClientMessage(playerid, COLOR_VERDE, "Cor do laser alterada"); else if (!strcmp(tmp, "rosa", true)) SetPVarInt(playerid, "color", 19081),SendClientMessage(playerid, COLOR_VERDE, "Cor do laser alterada"); else if (!strcmp(tmp, "laranja", true)) SetPVarInt(playerid, "color", 19082),SendClientMessage(playerid, COLOR_VERDE, "Cor do laser alterada"); else if (!strcmp(tmp, "verde", true)) SetPVarInt(playerid, "color", 19083),SendClientMessage(playerid, COLOR_VERDE, "Cor do laser alterada"); else if (!strcmp(tmp, "amarelo", true)) SetPVarInt(playerid, "color", 19084),SendClientMessage(playerid, COLOR_VERDE, "Cor do laser alterada"); else SendClientMessage(playerid, COLOR_VERMELHO, "Cor invбlida. (Cores disponнveis: vermelho, azul, rosa, laranja, verde e amarelo)"); return 1;} if (!strcmp("/kill", cmdtext, true || !strcmp("/morrer", cmdtext, true))){ SetPlayerHealth(playerid, 0.0); return 1;} return SendClientMessage(playerid, COLOR_VERMELHO, "Comando invбlido, para ver os comandos use: /ajuda"),GameTextForPlayer(playerid,"~r~~n~~n~~n~/AJUDA", 3000, 5); } public DesligarCameraAssasino(playerid){ if(VendoAssasino[playerid] == true)TogglePlayerSpectating(playerid, 0),SpawnPlayer(playerid),VendoAssasino[playerid] = false,TextDrawHideForPlayer(playerid, TextoVendoAssasino),KillTimer(DesligarCameraAssasino(playerid)); return 1;} public OnPlayerEnterCheckpoint(playerid) { if(CPS_IsPlayerInCheckpoint(playerid, Checkpoint_Americanos)){ if(GetPlayerSkin(playerid) == 179 || 191 || 287) ShowPlayerDialog(playerid, 12475, DIALOG_STYLE_LIST, "Compra de armas","M4 - $20.000\nShotgun - $10.000\nSniper - $15.000\n9mm - $3.000\nFaca - $500\nRifle - $12.000\nSawn-off - $30.000\nAK-47 - $20.000", "Comprar", "Cancelar");} return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { #define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) if (PRESSED(KEY_FIRE)){if (VendoAssasino[playerid] == true)TogglePlayerSpectating(playerid, 0),SpawnPlayer(playerid),VendoAssasino[playerid] = false;} return 1; } public OnPlayerUpdate(playerid) { if(!IsPlayerInAnyVehicle(playerid)) { new Armas[MAX_PLAYERS],Balas[MAX_PLAYERS]; GetPlayerWeaponData(playerid, 5, Armas[playerid], Balas[playerid]); if(Armas[playerid] == 30 && Balas[playerid] >= 1) { if(GetPlayerWeapon(playerid) == 30) RemovePlayerAttachedObject(playerid,SlotAKeFUZIL); else SetPlayerAttachedObject(playerid, SlotAKeFUZIL, 355, 1, -0.060921, -0.141673, 0.000000, 0.000000, 35.362735, 0.000000); } else if(Armas[playerid] == 31 && Balas[playerid] >= 1) { if(GetPlayerWeapon(playerid) == 31) RemovePlayerAttachedObject(playerid,SlotAKeFUZIL); else SetPlayerAttachedObject(playerid, SlotAKeFUZIL, 356, 1, -0.099681, -0.133408, 0.000000, 1.027592, 19.667785, 0.000000); } else { RemovePlayerAttachedObject(playerid,SlotAKeFUZIL); } GetPlayerWeaponData(playerid, 3, Armas[playerid], Balas[playerid]); if(Armas[playerid] == 25 && Balas[playerid] >= 1) { if(GetPlayerWeapon(playerid) == 25) RemovePlayerAttachedObject(playerid,SlotEscopeta); else SetPlayerAttachedObject(playerid, SlotEscopeta, 349, 1, -0.109260, -0.059651, -0.066210, 186.310729, 42.375362, 6.716565); } else if(Armas[playerid] == 27 && Balas[playerid] >= 1) { if(GetPlayerWeapon(playerid) == 27) RemovePlayerAttachedObject(playerid,SlotEscopeta); else SetPlayerAttachedObject(playerid, SlotEscopeta, 351, 1, -0.181073, -0.056285, -0.081242, 181.269729, 39.399085, 12.246994); } else { RemovePlayerAttachedObject(playerid,SlotEscopeta); } } new Float:Health; GetPlayerHealth(playerid,Health); if(Health >= 95) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[1]); TextDrawShowForPlayer(playerid,HealthBar[2]); } else if(Health >= 90 && Health < 95) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[1]); TextDrawShowForPlayer(playerid,HealthBar[3]); } else if(Health >= 85 && Health < 90) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[1]); TextDrawShowForPlayer(playerid,HealthBar[4]); } else if(Health >= 80 && Health < 85) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[1]); TextDrawShowForPlayer(playerid,HealthBar[5]); } else if(Health >= 75 && Health < 80) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[1]); TextDrawShowForPlayer(playerid,HealthBar[6]); } else if(Health >= 70 && Health < 75) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[7]); TextDrawShowForPlayer(playerid,HealthBar[8]); } else if(Health >= 65 && Health < 70) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[7]); TextDrawShowForPlayer(playerid,HealthBar[9]); } else if(Health >= 60 && Health < 65) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[7]); TextDrawShowForPlayer(playerid,HealthBar[10]); } else if(Health >= 55 && Health < 60) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[7]); TextDrawShowForPlayer(playerid,HealthBar[11]); } else if(Health >= 50 && Health < 55) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[7]); TextDrawShowForPlayer(playerid,HealthBar[12]); } else if(Health >= 45 && Health < 50) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[13]); TextDrawShowForPlayer(playerid,HealthBar[14]); } else if(Health >= 40 && Health < 45) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[13]); TextDrawShowForPlayer(playerid,HealthBar[15]); } else if(Health >= 35 && Health < 40) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[13]); TextDrawShowForPlayer(playerid,HealthBar[16]); } else if(Health >= 30 && Health < 35) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[13]); TextDrawShowForPlayer(playerid,HealthBar[17]); } else if(Health >= 25 && Health < 30) { for(new i=1; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); TextDrawShowForPlayer(playerid,HealthBar[13]); TextDrawShowForPlayer(playerid,HealthBar[18]); } else { for(new i=0; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]); } if (GetPVarInt(playerid, "laser")) { RemovePlayerAttachedObject(playerid, 0); if ((IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid))) return 1; switch (GetPlayerWeapon(playerid)) { case 23: { if (IsPlayerAiming(playerid)) { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.108249, 0.030232, 0.118051, 1.468254, 349.862579, 364.784240); } } else { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216); } } } case 27: { if (IsPlayerAiming(playerid)) { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.588246, -0.022766, 0.138052, -11.531745, 347.712585, 352.784271); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.588246, -0.022766, 0.138052, 1.468254, 350.712585, 352.784271); } } else { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216); } } } case 30: { if (IsPlayerAiming(playerid)) { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.628249, -0.027766, 0.078052, -6.621746, 352.552642, 355.084289); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.628249, -0.027766, 0.078052, -1.621746, 356.202667, 355.084289); } } else { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216); } } } case 31: { if (IsPlayerAiming(playerid)) { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289); } } else { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222); } } } case 34: { if (IsPlayerAiming(playerid)) { return 1; } else { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259); } } } case 29: { if (IsPlayerAiming(playerid)) { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259); } } else { if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222); } else { SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222); } } } } } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 12475) { { if(response) { if(listitem == 0) { if(GetPlayerMoney(playerid) < 20000) return SendClientMessage(playerid, COLOR_VERMELHO, "Vocк precisa de $20.000 para comprar essa arma"); SendClientMessage(playerid, COLOR_VERDE, "Vocк comprou uma M4 pelo preзo de $20.000!"); GivePlayerWeapon(playerid, 356, 10000); GivePlayerMoney(playerid, -20000); return true; } if(listitem == 1) { if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, COLOR_VERMELHO, "Vocк precisa de $10.000 para comprar essa arma"); SendClientMessage(playerid, COLOR_VERDE, "Vocк comprou uma SHOTGUN pelo preзo de $10.000!"); GivePlayerWeapon(playerid, 349, 10000); GivePlayerMoney(playerid, -10000); return true; } if(listitem == 2) { if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid, COLOR_VERMELHO, "Vocк precisa de $15.000 para comprar essa arma"); SendClientMessage(playerid, COLOR_VERDE, "Vocк comprou uma SNIPER pelo preзo de $15.000!"); GivePlayerWeapon(playerid, 358, 10000); GivePlayerMoney(playerid, -15000); return true; } if(listitem == 3) { if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, COLOR_VERMELHO, "Vocк precisa de $3.000 para comprar essa arma"); SendClientMessage(playerid, COLOR_VERDE, "Vocк comprou uma 9MM pelo preзo de $3.000!"); GivePlayerWeapon(playerid, 346, 10000); GivePlayerMoney(playerid, -3000); return true; } if(listitem == 4) { if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, COLOR_VERMELHO, "Vocк precisa de $500 para comprar essa arma"); SendClientMessage(playerid, COLOR_VERDE, "Vocк comprou uma FACA pelo preзo de $500!"); GivePlayerWeapon(playerid, 335, 1); GivePlayerMoney(playerid, -500); return true; } if(listitem == 5) { if(GetPlayerMoney(playerid) < 12000) return SendClientMessage(playerid, COLOR_VERMELHO, "Vocк precisa de $12.000 para comprar essa arma"); SendClientMessage(playerid, COLOR_VERDE, "Vocк comprou um RIFLE pelo preзo de $12.000!"); GivePlayerWeapon(playerid, 357, 10000); GivePlayerMoney(playerid, -12000); return true; } if(listitem == 6) { if(GetPlayerMoney(playerid) < 30000) return SendClientMessage(playerid, COLOR_VERMELHO, "Vocк precisa de $30.000 para comprar essa arma"); SendClientMessage(playerid, COLOR_VERDE, "Vocк comprou uma SAWN-OFF pelo preзo de $30.000!"); GivePlayerWeapon(playerid, 350, 10000); GivePlayerMoney(playerid, -30000); return true; } if(listitem == 7) { if(GetPlayerMoney(playerid) < 20000) return SendClientMessage(playerid, COLOR_VERMELHO, "Vocк precisa de $20.000 para comprar essa arma"); SendClientMessage(playerid, COLOR_VERDE, "Vocк comprou uma AK-47 pelo preзo de $20.000!"); GivePlayerWeapon(playerid, 355, 10000); GivePlayerMoney(playerid, -20000); return true; } } } } return 1; } stock IsPlayerInWater(playerid) { new anim = GetPlayerAnimationIndex(playerid); if (((anim >= 1538) && (anim <= 1542)) || (anim == 1544) || (anim == 1250) || (anim == 1062)) return 1; return 0; } stock IsPlayerAiming(playerid) { new anim = GetPlayerAnimationIndex(playerid); if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) || (anim == 1643) || (anim == 1453) || (anim == 220)) return 1; return 0; } stock PlayerName(playerid) { new name[255]; GetPlayerName(playerid, name, 255); return name; } strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; }