29.11.2012, 15:21
Can someone help to convert this FS from zcmd to strcmp or dcmd
FS is not mine.
FS is not mine.
Код:
/* ex_War made by dock DO NOT REMOVE CREDITS Verzija: 0.1 beta */ #include <a_samp> #include <zcmd> #include <sscanf2> #include <foreach> #define COLOR_GREY 0xB4B5B7FF #define COLOR_RED 0xFF0000AA #define COLOR_LB 0x00FFFFAA #define COLOR_LR 0xF05D5DAA #define COL_GREY "{B3B5B7}" #define SEM SendClientMessage(playerid, COLOR_RED, " (WAR) "COL_GREY"Nemate ovlasti da korisite ovu komandu!"); #define ID_INVALID SendClientMessage(playerid, COLOR_RED, " (WAR) "COL_GREY"Igrac nije online!"); #define War_VW 44 // promenite ako vam ne odgovara.. #define func%0(%1) forward%0(%1); \ public%0(%1) new WarBrojanje1 = 0; new WarBrojanje2 = 0; new WarTim[MAX_PLAYERS] = 0; new WarZapocet = 0; new warbrojanje; new war; new Float:War1_x,Float:War1_y,Float:War1_z,Float:War1_r,Float:War2_x,Float:War2_y,Float:War2_z,Float:War2_r; //Mape za war, dodajete ovako: // {Tim1_x, Tim1_y, Tim1_z, Tim1_rotacija, Tim2_x, Tim2_y, Tim2_z, Tim2_rotacija} // ma kraju { } morate imati zarez (ovako: {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},) osim kod zadnjih koordinata.. new Float:WarMape[][8] = { {-110.3039,-103.5038, 3.1172, 346.8858, 41.4104, 125.5839, 3.1172, 158.5432} }; public OnFilterScriptInit() { print("\n--------------------------------------"); print(" ex_War by loaded"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } //Komande CMD:war(playerid,params[]) { if(!IsPlayerAdmin(playerid))return SEM new id, tim; if(sscanf(params,"ui",id,tim)) return SendClientMessage(playerid, COLOR_GREY, "*Koristi: /war [id igraca] [tim (0-2)]"); else if(id == INVALID_PLAYER_ID) return ID_INVALID WarTim[id] = tim; if(WarTim[id] == 0) { SetPlayerColor(playerid, 0xffffffff); } else if(WarTim[id] == 1) { SetPlayerColor(playerid, 0xff0000aa); } else if(WarTim[id] == 2) { SetPlayerColor(playerid, 0x0000ffaa); } new str[256]; new ime[MAX_PLAYER_NAME]; GetPlayerName(playerid,ime,sizeof(ime)); new igrac[MAX_PLAYER_NAME]; GetPlayerName(id,igrac,sizeof(igrac)); format(str,256," War | Prozvani ste na war od admina %s!", ime); SendClientMessage(id, COLOR_LB, str); format(str,256," War | Prozvali ste igraca %s na war!", igrac); SendClientMessage(playerid, COLOR_LB, str); return 1; } CMD:warpokreni(playerid,params[]) { if(!IsPlayerAdmin(playerid))return SEM new mapa, vreme; if(sscanf(params,"ii",mapa,vreme)) return SendClientMessage(playerid, COLOR_GREY, "*Koristi: /warpokreni [id mape] [vreme (u minutima)]"), SendClientMessage(playerid, COLOR_GREY, "*IDevi mapa: 0) Ime mape"); War1_x = WarMape[mapa][0]; War1_y = WarMape[mapa][1]; War1_z = WarMape[mapa][2]; War1_r = WarMape[mapa][3]; War2_x = WarMape[mapa][4]; War2_y = WarMape[mapa][5]; War2_z = WarMape[mapa][6]; War2_r = WarMape[mapa][7]; war = SetTimer("WarTimer", vreme*60000, false); warbrojanje = SetTimer("WarBrojanje", 3000, true); foreach(Player,i) { if(WarTim[i] > 0) { SpawnPlayer(i); } } WarZapocet = 1; return 1;} CMD:warzaustavi(playerid,params[]) { if(!IsPlayerAdmin(playerid))return SEM new str[256]; format(str,256," War | War je zavrsen! TIM 1: %d, TIM 2: %d", WarBrojanje1, WarBrojanje2); SendWarMessage(COLOR_RED, str); KillTimer(war); WarTimer(); return 1; } func WarTimer() { foreach(Player, i) { if(WarTim[i] > 0) { if(WarTim[i] == 1) { new str[256]; format(str,256," War | War je zavrsen! Vi: %d, Oni: %d", WarBrojanje1, WarBrojanje2); SendWarMessage(COLOR_LR, str); } else if(WarTim[i] == 2) { new str[256]; format(str,256," War | War je zavrsen! Vi: %d, Oni: %d", WarBrojanje2, WarBrojanje1); SendWarMessage(COLOR_LR, str); } WarTim[i] = 0; WarZapocet = 0; SpawnPlayer(i); KillTimer(warbrojanje); } } return 1; } func WarBrojanje() { foreach(Player, i) { if(WarTim[i] > 0) { if(WarTim[i] == 1) { new str[256]; format(str,256,"~g~war~n~~p~Vi: ~w~%d~n~~p~Oni: ~w~%d", WarBrojanje1, WarBrojanje2); GameTextForPlayer(i, str, 3000, 1); } else if(WarTim[i] == 2) { new str[256]; format(str,256,"~g~war~n~~p~Vi: ~w~%d~n~~p~Oni: ~w~%d", WarBrojanje2, WarBrojanje1); GameTextForPlayer(i, str, 3000, 1); } } } return 1; } stock Admin(playerid, level) { if(!IsPlayerAdmin(playerid))return 1; if(CallRemoteFunction("GetPlayerWarAdmin", "d", playerid) >= level) return 1; return 0; } stock SendWarMessage(color,text[]) { foreach(Player,i) { if(WarTim[i] > 0) { SendClientMessage(i, color, text); } } return 1; } public OnPlayerRequestClass(playerid, classid) { return 1; } public OnPlayerConnect(playerid) { return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) { if(WarTim[playerid] == 0) { SetPlayerColor(playerid, 0xffffffff); } else if(WarTim[playerid] == 1) { SetPlayerColor(playerid, 0xff0000aa); } else if(WarTim[playerid] == 2) { SetPlayerColor(playerid, 0x0000ffaa); } if(WarZapocet == 1) { if(WarTim[playerid] == 1) { SetPlayerVirtualWorld(playerid, War_VW); SetPlayerPos(playerid, War1_x, War1_y, War1_z); SetPlayerFacingAngle(playerid, War1_r); GivePlayerWeapon(playerid, 24, 200);// dodajte jos oruzja ako vam je volja :D GivePlayerWeapon(playerid, 31, 500); SetPlayerHealth(playerid, 100); return 1; } else if(WarTim[playerid] == 2) { SetPlayerVirtualWorld(playerid, War_VW); SetPlayerPos(playerid, War2_x, War2_y, War2_z); SetPlayerFacingAngle(playerid, War2_r); GivePlayerWeapon(playerid, 24, 200);// dodajte jos oruzja ako vam je volja :D GivePlayerWeapon(playerid, 31, 500); SetPlayerHealth(playerid, 100); return 1; } } return 1; } public OnPlayerDeath(playerid, killerid, reason) { new ime[MAX_PLAYER_NAME]; GetPlayerName(killerid, ime, sizeof(ime)); new igrac[MAX_PLAYER_NAME]; GetPlayerName(playerid, igrac, sizeof(igrac)); if(WarZapocet == 1) { if(WarTim[killerid] == 1) { if(WarTim[playerid] == 1) { WarBrojanje2++; SendClientMessage(playerid, COLOR_RED, "*Protivnici su dobili bod jer ste TKali!"); } else { WarBrojanje1++; new str[256]; format(str,256," (War) Igrac %s je ubio %s", ime, igrac); SendWarMessage(COLOR_LR, str); } } if(WarTim[killerid] == 2) { if(WarTim[playerid] == 2) { WarBrojanje1++; SendClientMessage(playerid, COLOR_RED, "*Protivnici su dobili bod jer ste TKali!"); } else { WarBrojanje2++; new str[256]; format(str,256," (War) Igrac %s je ubio %s", ime, igrac); SendWarMessage(COLOR_LR, str); } } } 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; } // ================== < [ CREDITS DOCK ] > ================== //