Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <streamer>
- #include <easydialog>
- #include <ShowInfoForPlayer>
- #define MAX_CORPS 50
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_YELLOW 0xDABB3EAA
- enum pDesc // A SUPPRIMER
- {
- dTaille,
- dPoids,
- dCheveux[128],
- dVetements[128],
- dSignes[128],
- dRapide[96]
- }
- enum pInfo // A SUPPRIMER
- {
- pDeath,
- Float:pDeathPos[3],
- pDeathInt,
- pDeathVW,
- pDeathType,
- pDeathBy[24],
- }
- new PlayerInfo[MAX_PLAYERS][pInfo]; // A SUPPRIMER
- new PlayerDesc[MAX_PLAYERS][pDesc]; // A SUPPRIMER
- enum cInfo
- {
- cId,
- cName[24],
- cIdPlayer,
- Float:cPos[3],
- cInterior,
- cVirtualWorld,
- cReason,
- cKilleur[24],
- cObject[7],
- cDescription[98],
- Text3D:cDesc
- }
- new CorpsInfo[MAX_CORPS][cInfo];
- new timerdeath[MAX_PLAYERS];
- new timerfire[MAX_CORPS];
- new timerenterrer[MAX_PLAYERS];
- new EnterrerTime[MAX_PLAYERS];
- new FireBody[MAX_CORPS];
- new CarryBody[MAX_PLAYERS];
- new nbCorps = 1;
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_NO)
- {
- if(PlayerInfo[playerid][pDeath] == 1)
- PlayerDeathTime(playerid);
- if(CarryBody[playerid] > 0)
- {
- StopCarry(playerid);
- return 1;
- }
- if(IsPlayerNearBody(playerid,2.0))
- {
- new body = IsPlayerNearBody(playerid,2.0);
- if(EnterrerTime[playerid] > 1)
- {
- EnterrerTime[playerid] = 0;
- KillTimer(timerenterrer[body]);
- TogglePlayerControllable(playerid,1);
- ShowInfoForPlayer(playerid, "~r~Vous annulez l'enterrement du corps", 4000);
- return 1;
- }
- Dialog_Show(playerid, Body, DIALOG_STYLE_LIST, "Corps", "Porter\nBrûler\nEnterrer", "Selectionner", "Annuler");
- return 1;
- }
- return 1;
- }
- return 1;
- }
- forward IsPlayerNearBody(playerid,Float:range);
- public IsPlayerNearBody(playerid,Float:range)
- {
- if(IsPlayerConnected(playerid))
- {
- for(new i = 1; i < nbCorps; i++)
- {
- if(IsPlayerInRangeOfPoint(playerid,range, CorpsInfo[i][cPos][0],CorpsInfo[i][cPos][1],CorpsInfo[i][cPos][2]))
- {
- return i;
- }
- }
- }
- return 0;
- }
- forward BodyFire(id);
- public BodyFire(id)
- {
- DestroyBody(id);
- return 1;
- }
- forward DestroyBody(id);
- public DestroyBody(id)
- {
- CorpsInfo[id][cId] = 0;
- CorpsInfo[id][cPos][0] = 0;
- CorpsInfo[id][cPos][1] = 0;
- CorpsInfo[id][cPos][2] = 0;
- CorpsInfo[id][cInterior] = 0;
- CorpsInfo[id][cReason] = 0;
- for(new i = 0; i < 7; i++)
- DestroyObject(CorpsInfo[id][cObject][i]);
- Delete3DTextLabel(CorpsInfo[id][cDesc]);
- nbCorps--;
- return 1;
- }
- forward StopCarry(playerid);
- public StopCarry(playerid)
- {
- new Float:Pos[3],str[256];
- GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
- CorpsInfo[CarryBody[playerid]][cPos][0] = Pos[0];
- CorpsInfo[CarryBody[playerid]][cPos][1] = Pos[1];
- CorpsInfo[CarryBody[playerid]][cPos][2] = Pos[2]-0.9;
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
- format(str,sizeof(str), "%s", CorpsInfo[CarryBody[playerid]][cDescription]);
- CorpsInfo[CarryBody[playerid]][cObject][0] = CreateObject(2907, CorpsInfo[CarryBody[playerid]][cPos][0],CorpsInfo[CarryBody[playerid]][cPos][1],CorpsInfo[CarryBody[playerid]][cPos][2], 0, 0, 274);
- CorpsInfo[CarryBody[playerid]][cObject][1] = CreateObject(2905, CorpsInfo[CarryBody[playerid]][cPos][0]+0.85376, CorpsInfo[CarryBody[playerid]][cPos][1]+0.161621, CorpsInfo[CarryBody[playerid]][cPos][2]-0.01857662, 0, 26, 278);
- CorpsInfo[CarryBody[playerid]][cObject][2] = CreateObject(2905, CorpsInfo[CarryBody[playerid]][cPos][0]+0.739746, CorpsInfo[CarryBody[playerid]][cPos][1]-0.158935, CorpsInfo[CarryBody[playerid]][cPos][2]+0.006423, 356.68469238281, 145.93511962891, 263.75891113281);
- CorpsInfo[CarryBody[playerid]][cObject][3] = CreateObject(2906, CorpsInfo[CarryBody[playerid]][cPos][0]-0.081787, CorpsInfo[CarryBody[playerid]][cPos][1]+0.239991, CorpsInfo[CarryBody[playerid]][cPos][2]-0.03601265, 359.30590820313, 273.93939208984, 298.02392578125);
- CorpsInfo[CarryBody[playerid]][cObject][4] = CreateObject(2906, CorpsInfo[CarryBody[playerid]][cPos][0]-0.024414, CorpsInfo[CarryBody[playerid]][cPos][1]-0.30957, CorpsInfo[CarryBody[playerid]][cPos][2]-0.03601265, 359.01071166992, 339.99688720703, 242.68936157227);
- CorpsInfo[CarryBody[playerid]][cDesc] = Create3DTextLabel(str, COLOR_ORANGE,CorpsInfo[CarryBody[playerid]][cPos][0],CorpsInfo[CarryBody[playerid]][cPos][1],CorpsInfo[CarryBody[playerid]][cPos][2], 40.0, 0, 0);
- CarryBody[playerid] = 0;
- ShowInfoForPlayer(playerid, "~g~Vous posez le corps au sol", 4000);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Crouch_Out", 2.0, 0, 0, 0, 0, 0);
- SendEmote(playerid,"pose un corps au sol");
- return 1;
- }
- forward CarryCorps(playerid,id);
- public CarryCorps(playerid,id)
- {
- new Float:Pos[3];
- GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
- CarryBody[playerid] = id;
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_CARRY);
- CorpsInfo[id][cPos][0] = 0;
- CorpsInfo[id][cPos][1] = 0;
- CorpsInfo[id][cPos][2] = 0;
- for(new i = 0; i < 6; i++)
- DestroyObject(CorpsInfo[id][cObject][i]);
- SetPlayerAttachedObject(playerid, 0, 2907,0,Position[0],Position[1],Position[2]);
- SetPlayerAttachedObject(playerid, 1, 2905,0,Position[0]+0.85376, Position[1]+0.161621,Position[2]-0.01857662, 0, 26, 278);
- SetPlayerAttachedObject(playerid, 2, 2905,0,Position[0]+0.739746, Position[1]-0.158935,Position[2]+0.006423, 356.68469238281, 145.93511962891, 263.75891113281);
- SetPlayerAttachedObject(playerid, 3, 2906,0,Position[0]-0.081787, Position[1]+0.239991,Position[2]-0.03601265, 359.30590820313, 273.93939208984, 298.02392578125);
- SetPlayerAttachedObject(playerid, 4, 2906,0,Position[0]-0.024414, Position[1]-0.30957,Position[2]-0.03601265, 359.01071166992, 339.99688720703, 242.68936157227);
- Delete3DTextLabel(CorpsInfo[id][cDesc]);
- ShowInfoForPlayer(playerid, "~r~Vous prenez le corps dans vos bras", 4000);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Crouch_Out", 2.0, 0, 0, 0, 0, 0);
- SendEmote(playerid,"attrape un corps au sol puis le met dans ses mains");
- return 1;
- }
- forward ProcessDeath(playerid);
- public ProcessDeath(playerid)
- {
- new str[256];
- for(new i = 1; i < MAX_CORPS; i++)
- {
- if(CorpsInfo[i][cId] == 0)
- {
- CorpsInfo[i][cId] = i;
- CorpsInfo[i][cPos][0] = PlayerInfo[playerid][pDeathPos][0];
- CorpsInfo[i][cPos][1] = PlayerInfo[playerid][pDeathPos][1];
- CorpsInfo[i][cPos][2] = PlayerInfo[playerid][pDeathPos][2]-0.9;
- CorpsInfo[i][cInterior] = PlayerInfo[playerid][pDeathInt];
- CorpsInfo[i][cReason] = PlayerInfo[playerid][pDeathType];
- format(str,sizeof(str),CorpsInfo[cDescription],"%s", PlayerDesc[playerid][dRapide]);
- format(str,sizeof(str),CorpsInfo[cKilleur],"%s", PlayerInfo[playerid][pDeathBy]);
- format(str,sizeof(str),CorpsInfo[cName],"%s", returnName(playerid));
- CorpsInfo[i][cObject][0] = CreateObject(2907, CorpsInfo[i][cPos][0],CorpsInfo[i][cPos][1],CorpsInfo[i][cPos][2], 0, 0, 274);
- CorpsInfo[i][cObject][1] = CreateObject(2905, CorpsInfo[i][cPos][0]+0.85376, CorpsInfo[i][cPos][1]+0.161621, CorpsInfo[i][cPos][2]-0.01857662, 0, 26, 278);
- CorpsInfo[i][cObject][2] = CreateObject(2905, CorpsInfo[i][cPos][0]+0.739746, CorpsInfo[i][cPos][1]-0.158935, CorpsInfo[i][cPos][2]+0.006423, 356.68469238281, 145.93511962891, 263.75891113281);
- CorpsInfo[i][cObject][3] = CreateObject(2906, CorpsInfo[i][cPos][0]-0.081787, CorpsInfo[i][cPos][1]+0.239991, CorpsInfo[i][cPos][2]-0.03601265, 359.30590820313, 273.93939208984, 298.02392578125);
- CorpsInfo[i][cObject][4] = CreateObject(2906, CorpsInfo[i][cPos][0]-0.024414, CorpsInfo[i][cPos][1]-0.30957, CorpsInfo[i][cPos][2]-0.03601265, 359.01071166992, 339.99688720703, 242.68936157227);
- CorpsInfo[i][cDesc] = Create3DTextLabel(str, COLOR_ORANGE,CorpsInfo[i][cPos][0],CorpsInfo[i][cPos][1],CorpsInfo[i][cPos][2], 40.0, 0, 0);
- nbCorps++;
- /*
- Mettre les bonnes positions de l'intérieur de l'hôpital
- */
- SetPlayerPos(playerid, -1779.3744,3216.9727,586.8616);
- SetPlayerCameraPos(playerid, -1779.3744,3216.9727,586.8616);
- SetPlayerCameraLookAt(playerid, -1652.8186,2566.7886,84.2408);
- ShowInfoForPlayer(playerid, "Vous êtes à l'hôpital pour 1 minutes", 10000);
- SetTimerEx("PlayerRevive", 60000, false, "i", playerid);
- return 1;
- }
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- if(CarryBody[playerid] > 0)
- {
- StopCarry(playerid);
- return 1;
- }
- return 1;
- }
- forward PlayerRevive(playerid);
- public PlayerRevive(playerid)
- {
- PlayerInfo[playerid][pDeath] = 0;
- PlayerInfo[playerid][pDeathPos][0] = 0;
- PlayerInfo[playerid][pDeathPos][1] = 0;
- PlayerInfo[playerid][pDeathPos][2] = 0;
- PlayerInfo[playerid][pDeathInt] = 0;
- PlayerInfo[playerid][pDeathVW] = 0;
- PlayerInfo[playerid][pDeathType] = 0;
- PlayerInfo[playerid][pDeathBy] = 0;
- SetPlayerHealth(playerid,50);
- TogglePlayerControllable(playerid,1);
- SetPlayerPos(playerid, 1172.7332,-1323.6276,15.4014);
- SetPlayerFacingAngle(playerid,181.4810);
- SetPlayerInterior(playerid,0);
- SetPlayerVirtualWorld(playerid,0);
- SetCameraBehindPlayer(playerid);
- return 1;
- }
- forward PlayerRespawnDeath(playerid);
- public PlayerRespawnDeath(playerid)
- {
- SetPlayerPos(playerid,PlayerInfo[playerid][pDeathPos][0],PlayerInfo[playerid][pDeathPos][1],PlayerInfo[playerid][pDeathPos][2]);
- SetPlayerInterior(playerid,PlayerInfo[playerid][pDeathInt]);
- SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pDeathVW]);
- if(PlayerInfo[playerid][pDeathType] == 49 || PlayerInfo[playerid][pDeathType] == 50)
- {
- PlayerRevive(playerid);
- return 1;
- }
- SendClientMessage(playerid,COLOR_YELLOW,"Vous venez d'être tuer, vous ne pouvez plus bouger jusqu'a ce que les secoures arrivent.");
- SendClientMessage(playerid,COLOR_YELLOW,"Si quelqu'un vous achève, vous irez à l'hôpital.");
- SendClientMessage(playerid,COLOR_YELLOW,"Si vous déconnectez, vous irez à l'hôpital");
- SendClientMessage(playerid,COLOR_YELLOW,"Si vous ne voulez pas attendre les secoures appuiez sur N");
- SetPlayerHealth(playerid,25);
- TogglePlayerControllable(playerid,0);
- ApplyAnimation(playerid, "PARACHUTE", "FALL_skyDive_DIE", 4.0, 0, 1, 1, 1, -1);
- timerdeath[playerid] = SetTimerEx("PlayerDeathTime", 600000, false, "i", playerid);
- return 1;
- }
- forward PlayerDeathTime(playerid);
- public PlayerDeathTime(playerid)
- {
- if(PlayerInfo[playerid][pDeath] == 1)
- ProcessDeath(playerid);
- KillTimer(timerdeath[playerid]);
- return 1;
- }
- forward PlayerDeath(playerid,reason,killed[24]);
- public PlayerDeath(playerid,reason,killed[24])
- {
- new Float:Pos[3];
- GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
- PlayerInfo[playerid][pDeath] = 1;
- PlayerInfo[playerid][pDeathPos][0] = Pos[0];
- PlayerInfo[playerid][pDeathPos][1] = Pos[1];
- PlayerInfo[playerid][pDeathPos][2] = Pos[2];
- PlayerInfo[playerid][pDeathInt] = GetPlayerInterior(playerid);
- PlayerInfo[playerid][pDeathVW] = GetPlayerVirtualWorld(playerid);
- PlayerInfo[playerid][pDeathType] = reason;
- PlayerInfo[playerid][pDeathBy] = killed;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(PlayerInfo[playerid][pDeath] == 1)
- PlayerRespawnDeath(playerid);
- if(PlayerInfo[playerid][pDeath] == 2)
- ProcessDeath(playerid);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(CarryBody[playerid] > 0)
- StopCarry(playerid);
- if(PlayerInfo[playerid][pDeath] == 1)
- PlayerInfo[playerid][pDeath] = 2;
- if(PlayerInfo[playerid][pDeath] == 0)
- PlayerDeath(playerid,reason,returnName(killerid));
- return 1;
- }
- Dialog:Body(playerid, response, listitem, inputtext[])
- {
- if (response)
- {
- if(listitem == 0)
- {
- if(IsPlayerNearBody(playerid,2.0))
- {
- new body = IsPlayerNearBody(playerid,2.0);
- CarryCorps(playerid,body);
- return 1;
- }
- return 1;
- }
- if(listitem == 1)
- {
- /* METTRE CONDITION EN DEHORS DE LA VILLE */
- if(IsPlayerNearBody(playerid,2.0))
- {
- /*
- Ajouter les condition pour le brûler
- */
- new body = IsPlayerNearBody(playerid,2.0);
- ShowInfoForPlayer(playerid, "~g~Vous brulez le corps au sol", 6000);
- timerfire[body] = SetTimerEx("BodyFire",600000, false, "i",body);
- FireBody[body] = 1;
- SendEmote(playerid,"met le feu au corps");
- CorpsInfo[body][cObject][6] = CreateObject(18691, CorpsInfo[body][cPos][0],CorpsInfo[body][cPos][1],CorpsInfo[body][cPos][2]-1.3, 0, 0, 274);
- return 1;
- }
- return 1;
- }
- if(listitem == 2)
- {
- if(IsPlayerNearBody(playerid,2.0))
- {
- if(GetPlayerWeapon(playerid) != 6) return ShowInfoForPlayer(playerid, "~g~Vous n'avez pas une pelle en main", 6000);
- if(PlayerInfo[playerid][pEnergie] != 100) return ShowInfoForPlayer(playerid, "~g~Vous devez avoir 100% d'énergie", 6000);
- EnterrerTime[playerid] = 360;
- ShowInfoForPlayer(playerid, "~g~Vous enterrez le corps au sol appuiez sur N pour annuler.", 1000);
- TogglePlayerControllable(playerid,0);
- new body = IsPlayerNearBody(playerid,2.0);
- timerenterrer[body] = SetTimerEx("BodyEnterrer", 5000, 1, "ii",playerid,body);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Crouch_Out", 2.0, 0, 0, 0, 0, 0);
- SendEmote(playerid,"commence à enterrer le corps");
- }
- return 1;
- }
- }
- return 1;
- }
- forward BodyEnterrer(playerid,id);
- public BodyEnterrer(playerid,id)
- {
- new body = IsPlayerNearBody(playerid,3.0);
- if(IsPlayerNearBody(playerid,3.0))
- {
- if(EnterrerTime[playerid] > 1)
- {
- DownEnergie(playerid,-0.28);
- EnterrerTime[playerid] -= 5;
- ShowInfoForPlayer(playerid, "~g~Vous enterrez le corps au sol appuiez sur N pour annuler.", 1000);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Crouch_Out", 4.0, 0, 0, 0, 0, 0);
- return 1;
- }
- EnterrerTime[playerid] = 0;
- DestroyBody(body);
- KillTimer(timerenterrer[body]);
- TogglePlayerControllable(playerid,1);
- return 1;
- }
- KillTimer(timerenterrer[body]);
- return 1;
- }
- CMD:corpsinfo(playerid,params[])
- {
- new body = IsPlayerNearBody(playerid,2.0);
- new str[256],gunname[32];
- if(IsPlayerNearBody(playerid,3.0))
- {
- GetWeaponName(CorpsInfo[body][cReason],gunname,sizeof(gunname));
- format(str,sizeof(str),"Ce corps appartient à %s, il a été tuer avec l'arme '%s' par %s",CorpsInfo[body][cName],gunname,CorpsInfo[body][cKilleur]);
- SendClientMessage(playerid,COLOR_ORANGE,str);
- return 1;
- }
- return 1;
- }
- CMD:suppcorps(playerid,params[])
- {
- if(PlayerInfo[playerid][pAdmin] < ADMIN_LVL_ADMIN) return ShowInfoForPlayer(playerid, "~r~Votre niveau d'autorisation n'est pas assez haut pour effecter cette commande", 6000);
- new body = IsPlayerNearBody(playerid,2.0);
- if(IsPlayerNearBody(playerid,3.0))
- {
- DestroyBody(body);
- ShowInfoForPlayer(playerid, "~g~Vous supprimez le corps prêt de vous", 1000);
- return 1;
- }
- return 1;
- }
- CMD:revive(playerid,params[])
- {
- if(PlayerInfo[playerid][pAdmin] < ADMIN_LVL_ADMIN) return ShowInfoForPlayer(playerid, "~r~Votre niveau d'autorisation n'est pas assez haut pour effecter cette commande", 6000);
- new target,str[256];
- if(!sscanf(params, "u", target))
- {
- if (target != INVALID_PLAYER_ID)
- {
- PlayerInfo[target][pDeath] = 0;
- PlayerInfo[target][pDeathPos][0] = 0;
- PlayerInfo[target][pDeathPos][1] = 0;
- PlayerInfo[target][pDeathPos][2] = 0;
- PlayerInfo[target][pDeathInt] = 0;
- PlayerInfo[target][pDeathVW] = 0;
- PlayerInfo[target][pDeathType] = 0;
- PlayerInfo[target][pDeathBy] = 0;
- SetPlayerHealth(target,50);
- TogglePlayerControllable(target,1);
- ClearAnimations(target);
- format(str,sizeof(str),"L'admin %s viens de vous remettre en vie",returnName(playerid));
- ShowInfoForPlayer(target, str, 5000);
- format(str,sizeof(str),"Vous remettez en vie %s",returnName(target));
- ShowInfoForPlayer(playerid, str, 5000);
- }
- return 1;
- }
- return 1;
- }
- /*
- SCRIPT A AJOUTER APRES LA CONNEXION
- if(PlayerInfo[playerid][pDeath] == 1)
- {
- ProcessDeath(playerid);
- }
- */
- stock returnName(playerid)
- {
- new name[24];
- GetPlayerName(playerid, name, 24);
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement