Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------includes----------------------------------
- #include <a_samp>
- #include <YSI\y_ini>
- //------------------defines-----------------------------------
- #define COLOR_MAP_BALLAS 0x7647A277
- #define COLOR_MAP_GROVE 0x32CD3277
- #define COLOR_MAP_AZTECAS 0x00FFFF77
- #define COLOR_MAP_MAFIA 0x32323277
- #define COLOR_MAP_NA 0xFFFFFF77
- #define COLOR_MAP_TRANS 0xFFFFFF00
- #define COLOR_PLAYER_BALLAS 0x551A8B77
- #define COLOR_PLAYER_GROVE 0x00990077
- #define COLOR_PLAYER_AZTECAS 0x008B8B77
- #define COLOR_PLAYER_MAFIA 0x00000077
- #define TOTAL_CPOINTS 12//Adjust accordingly
- #define TOTAL_STURFS 4
- #define DIALOG_FACTION 1
- #define DIALOG_CLASS 2
- #define FACTION_BALLAS 0
- #define FACTION_GROVE 1
- #define FACTION_AZTECAS 2
- #define FACTION_MAFIA 3
- #define FACTION_LESS 4
- #define CLASS_LIGHT 0
- #define CLASS_HEAVY 1
- #define CLASS_SNIPER 2
- #define MIN_X 0
- #define MAX_X 1
- #define MIN_Y 2
- #define MAX_Y 3
- #define pX 0
- #define pY 1
- #define pZ 2
- #define waterX 137.4
- #define waterY 380.6
- #define waterZ -7.7
- #define FACTION 0
- #define CLASS 1
- #define INGAME 2
- #define HASPLAYED 3
- #define CUSTOMIZED 4
- #define WEAPONS 5
- #define AMMO 6
- //-------------------variables----------------------------------
- new
- pData[MAX_PLAYERS][5],
- pWeapons[MAX_PLAYERS][13][2],
- spawnTurfs[TOTAL_STURFS],
- capturePoint[TOTAL_CPOINTS],
- takingPoint[TOTAL_CPOINTS],
- shieldRegen[MAX_PLAYERS],
- damageTaken[MAX_PLAYERS],
- timer[TOTAL_CPOINTS],
- delayTimer[MAX_PLAYERS],
- lastPointOwner[TOTAL_CPOINTS]=
- {FACTION_LESS,FACTION_LESS,FACTION_LESS,FACTION_LESS,FACTION_LESS, // this is a rather annoying bug
- FACTION_LESS,FACTION_LESS,FACTION_LESS,FACTION_LESS,FACTION_LESS, // you need to add FACTION_LESS for
- FACTION_LESS,FACTION_LESS}; // every capture point, or it'll show as ballers
- new
- Float:stXY[TOTAL_STURFS][4],
- Float:cpXY[TOTAL_CPOINTS][4],
- Float:pPos[TOTAL_CPOINTS][3];
- //------------------forwards----------------------------------
- forward
- EnableShieldRegen(playerid);
- SetZone(playerid,point);
- SetPlayerPosDelayed(playerid);
- Loadstxy(tag[], name[], value[]);
- Loadcpxy(tag[], name[], value[]);
- LoadpPos(tag[], name[], value[]);
- LoadPlayerData(playerid,tag[],name[],value[]);
- SavePlayerData(playerid);
- //---------------------filter script----------------------------------
- public OnFilterScriptInit()
- {
- INI_ParseFile("planetside/stxy.ini", "Loadstxy", .bPassTag = true);
- INI_ParseFile("planetside/cpxy.ini", "Loadcpxy", .bPassTag = true);
- INI_ParseFile("planetside/ppos.ini", "LoadpPos", .bPassTag = true);
- for(new i;i<TOTAL_STURFS;i++) spawnTurfs[i] = GangZoneCreate(stXY[i][MIN_X],stXY[i][MIN_Y],stXY[i][MAX_X],stXY[i][MAX_Y]);
- for(new i;i<TOTAL_CPOINTS;i++) capturePoint[i]= GangZoneCreate(cpXY[i][MIN_X],cpXY[i][MIN_Y],cpXY[i][MAX_X],cpXY[i][MAX_Y]);
- for(new i;i<TOTAL_CPOINTS;i++) CreatePickup(1318,1,pPos[i][pX],pPos[i][pY],pPos[i][pZ],-1);
- print("\n--------------------------------------");
- print(" fail planetside by kSpade");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i;i<TOTAL_CPOINTS;i++)GangZoneShowForAll(capturePoint[i],COLOR_MAP_TRANS);
- for(new i;i<TOTAL_STURFS;i++)GangZoneShowForAll(spawnTurfs[i],COLOR_MAP_TRANS);
- for(new i;i<MAX_PLAYERS;i++)
- {
- if(pData[i][INGAME]==1)SetPlayerHealth(i,0.0);
- SavePlayerData(i);
- }
- return 1;
- }
- //--------------------On Player Stuff---------------------------
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/joingame",cmdtext,true,10)==0)
- {
- ShowPlayerDialog(playerid, DIALOG_FACTION, DIALOG_STYLE_LIST, "Choose Faction",
- "Ballas\nGrove Street\nVarios Los Aztecas\nMafia", "Select", "Close");
- return 1;
- }
- if (strcmp("/testdatasave",cmdtext,true,10)==0)
- {
- SavePlayerData(playerid);
- return 1;
- }
- return 0;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
- {
- if(pData[playerid][INGAME]==1)
- {
- if(IsPlayerInTurf(playerid)||IsPlayerInTurf(issuerid))
- {
- SendClientMessage(playerid,-1,"Turf Protection v1.1");
- if(IsPlayerInWater(playerid)||weaponid==37)
- {
- SetPlayerPos(playerid,waterX,waterY,waterZ);
- delayTimer[playerid]=SetTimerEx("SetPlayerPosDelayed",1000,false,"%i",playerid);
- }
- SetPlayerHealth(playerid,1000.0);
- SetPlayerArmour(playerid,100.0);
- return 1;
- }
- KillTimer(damageTaken[playerid]);
- shieldRegen[playerid]=0;
- damageTaken[playerid]=SetTimerEx("EnableShieldRegen",5000,false,"i",playerid);
- }
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(!IsPlayerConnected(playerid)) return 0;
- if(IsPlayerNPC(playerid)) return 1;
- if(shieldRegen[playerid]==1)
- {
- new Float:armor;
- GetPlayerArmour(playerid,armor);
- if(armor<=99.0)SetPlayerArmour(playerid,armor+1.0);
- }
- if(pData[playerid][INGAME]==1)
- {
- for(new i;i<TOTAL_CPOINTS;i++)
- {
- if(IsPlayerInRangeOfPoint(playerid,5,pPos[i][pX],pPos[i][pY],pPos[i][pZ])) StartCapture(playerid,i);
- else
- {
- if(takingPoint[i]==1)
- {
- UpdatePointStatus(playerid,i,0);
- KillTimer(timer[i]);
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- GangZoneShowForPlayer(playerid, spawnTurfs[0], COLOR_MAP_GROVE);
- GangZoneShowForPlayer(playerid, spawnTurfs[1], COLOR_MAP_BALLAS);
- GangZoneShowForPlayer(playerid, spawnTurfs[2], COLOR_MAP_AZTECAS);
- GangZoneShowForPlayer(playerid, spawnTurfs[3], COLOR_MAP_MAFIA);
- for(new i;i<TOTAL_CPOINTS;i++)
- {
- SetPlayerMapIcon(playerid,i,pPos[i][pX],pPos[i][pY],pPos[i][pZ],0,-1,1);
- switch(lastPointOwner[i])
- {
- case FACTION_BALLAS: GangZoneShowForPlayer(playerid, capturePoint[i], COLOR_MAP_BALLAS);
- case FACTION_GROVE: GangZoneShowForPlayer(playerid, capturePoint[i], COLOR_MAP_GROVE);
- case FACTION_AZTECAS: GangZoneShowForPlayer(playerid, capturePoint[i], COLOR_MAP_AZTECAS);
- case FACTION_MAFIA: GangZoneShowForPlayer(playerid, capturePoint[i], COLOR_MAP_MAFIA);
- case FACTION_LESS: GangZoneShowForPlayer(playerid, capturePoint[i], COLOR_MAP_NA);
- }
- }
- ResetPlayerWeapons(playerid);
- if(pData[playerid][HASPLAYED]==1) pData[playerid][INGAME]=1;
- if(pData[playerid][INGAME]==1)
- {
- SetFactionSkin(playerid);
- if(pData[playerid][CUSTOMIZED]!=1) GiveClassWeapons(playerid);
- else for(new i;i<=12;i++) GivePlayerWeapon(playerid,pWeapons[playerid][i][0],pWeapons[playerid][i][1]);
- delayTimer[playerid]=SetTimerEx("SetPlayerPosDelayed",1000,false,"i",playerid);
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_FACTION, DIALOG_STYLE_LIST, "Choose Faction",
- "Ballas\nGrove Street\nVarios Los Aztecas\nMafia", "Select", "Close");
- }
- }
- public OnPlayerConnect(playerid)
- {
- new
- playerName[MAX_PLAYER_NAME],
- userFile[64];
- GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
- format(userFile,sizeof(userFile),"%s",playerName);
- INI_ParseFile(userFile,"LoadPlayerData", .bExtra = true, .extra = playerid, .bPassTag = true);
- }
- public OnPlayerDisconnect(playerid)
- {
- pData[playerid][INGAME]=0;
- pData[playerid][HASPLAYED]=1;
- SavePlayerData(playerid);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_FACTION)
- {
- if(response)
- {
- switch(listitem)
- {
- case FACTION_BALLAS: pData[playerid][FACTION]=FACTION_BALLAS;
- case FACTION_GROVE: pData[playerid][FACTION]=FACTION_GROVE;
- case FACTION_AZTECAS: pData[playerid][FACTION]=FACTION_AZTECAS;
- case FACTION_MAFIA: pData[playerid][FACTION]=FACTION_MAFIA;
- }
- ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose Class",
- "Light Assault\nHeavy Assault\nSniper", "Select", "Close");
- return 1;
- }
- }
- else if(dialogid == DIALOG_CLASS)
- {
- if(response)
- {
- ResetPlayerWeapons(playerid);
- pData[playerid][INGAME]=1;
- switch(listitem)
- {
- case CLASS_LIGHT: pData[playerid][CLASS]=CLASS_LIGHT;
- case CLASS_HEAVY: pData[playerid][CLASS]=CLASS_HEAVY;
- case CLASS_SNIPER: pData[playerid][CLASS]=CLASS_SNIPER;
- }
- SetPlayerHealth(playerid,0.0);
- SetFactionSkin(playerid);
- GiveClassWeapons(playerid);
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
- {
- for(new i;i<TOTAL_CPOINTS;i++)
- {
- if(fX >= cpXY[i][MIN_X] && fX <= cpXY[i][MAX_X] && fY >= cpXY[i][MIN_Y] && fY <= cpXY[i][MAX_Y])
- {
- if(pData[playerid][FACTION]==lastPointOwner[i])
- {
- SetPlayerPos(playerid,fX,fY,fZ+1000);
- GivePlayerWeapon(playerid,46,1);
- }
- }
- }
- }
- //-------------------------functions-------------------------------------
- public SetPlayerPosDelayed(playerid)
- {
- switch(pData[playerid][FACTION])
- {
- case FACTION_BALLAS:
- {
- SetPlayerPos(playerid,-2477.12,2337.56,4.98);
- SetPlayerFacingAngle(playerid,218.85);
- }
- case FACTION_GROVE:
- {
- SetPlayerPos(playerid,2672.40,-2431.00,13.63);
- SetPlayerFacingAngle(playerid,281.00);
- }
- case FACTION_AZTECAS:
- {
- SetPlayerPos(playerid,2627.54,2758.31,23.82);
- SetPlayerFacingAngle(playerid,122.03);
- }
- case FACTION_MAFIA:
- {
- SetPlayerPos(playerid,-2159.77,-2415.11,30.62);
- SetPlayerFacingAngle(playerid,260.22);
- }
- }
- }
- stock SetFactionSkin(playerid)
- {
- switch(pData[playerid][FACTION])
- {
- case FACTION_BALLAS:
- {
- if(pData[playerid][CLASS]==CLASS_LIGHT)SetPlayerSkinFix(playerid, 102);
- if(pData[playerid][CLASS]==CLASS_HEAVY)SetPlayerSkinFix(playerid, 103);
- if(pData[playerid][CLASS]==CLASS_SNIPER)SetPlayerSkinFix(playerid, 104);
- SetPlayerColor(playerid,COLOR_PLAYER_BALLAS);
- }
- case FACTION_GROVE:
- {
- if(pData[playerid][CLASS]==CLASS_LIGHT)SetPlayerSkinFix(playerid, 107);
- if(pData[playerid][CLASS]==CLASS_HEAVY)SetPlayerSkinFix(playerid, 105);
- if(pData[playerid][CLASS]==CLASS_SNIPER)SetPlayerSkinFix(playerid, 106);
- SetPlayerColor(playerid,COLOR_PLAYER_GROVE);
- }
- case FACTION_AZTECAS:
- {
- if(pData[playerid][CLASS]==CLASS_LIGHT)SetPlayerSkinFix(playerid, 114);
- if(pData[playerid][CLASS]==CLASS_HEAVY)SetPlayerSkinFix(playerid, 115);
- if(pData[playerid][CLASS]==CLASS_SNIPER)SetPlayerSkinFix(playerid, 116);
- SetPlayerColor(playerid,COLOR_PLAYER_AZTECAS);
- }
- case FACTION_MAFIA:
- {
- if(pData[playerid][CLASS]==CLASS_LIGHT)SetPlayerSkinFix(playerid, 124);
- if(pData[playerid][CLASS]==CLASS_HEAVY)SetPlayerSkinFix(playerid, 125);
- if(pData[playerid][CLASS]==CLASS_SNIPER)SetPlayerSkinFix(playerid, 126);
- SetPlayerColor(playerid,COLOR_PLAYER_MAFIA);
- }
- }
- return 1;
- }
- stock GiveClassWeapons(playerid)
- {
- switch(pData[playerid][CLASS])
- {
- case CLASS_LIGHT:
- {
- GivePlayerWeapon(playerid,16,2);
- GivePlayerWeapon(playerid,22,500);
- GivePlayerWeapon(playerid,29,500);
- }
- case CLASS_HEAVY:
- {
- GivePlayerWeapon(playerid,35,4);
- GivePlayerWeapon(playerid,24,500);
- GivePlayerWeapon(playerid,30,500);
- }
- case CLASS_SNIPER:
- {
- GivePlayerWeapon(playerid,16,2);
- GivePlayerWeapon(playerid,23,500);
- GivePlayerWeapon(playerid,34,500);
- }
- }
- return 1;
- }
- public EnableShieldRegen(playerid)
- {
- shieldRegen[playerid]=1;
- return 1;
- }
- stock UpdatePointStatus(playerid,point,status)
- {
- if(status==1)
- {
- new msgToAlly[64],msgToOwner[64],temp[8];
- switch(pData[playerid][FACTION])
- {
- case 0:temp="Ballas";
- case 1:temp="Grove";
- case 2:temp="Aztecas";
- case 3:temp="Mafia";
- }
- format(msgToAlly,sizeof(msgToAlly),"Taking over point %i",point);
- format(msgToOwner,sizeof(msgToOwner),"Point %i is being taken over by the %s!",point,temp);
- for(new i;i<MAX_PLAYERS;i++)
- {
- if(pData[i][FACTION]==pData[playerid][FACTION]) SendClientMessage(i,-1,msgToAlly);
- if(lastPointOwner[point]==pData[i][FACTION])SendClientMessage(i,-1,msgToOwner);
- }
- takingPoint[point]=1;
- switch(pData[playerid][FACTION])
- {
- case FACTION_BALLAS: GangZoneFlashForAll(capturePoint[point],COLOR_MAP_BALLAS);
- case FACTION_GROVE: GangZoneFlashForAll(capturePoint[point],COLOR_MAP_GROVE);
- case FACTION_AZTECAS: GangZoneFlashForAll(capturePoint[point],COLOR_MAP_AZTECAS);
- case FACTION_MAFIA: GangZoneFlashForAll(capturePoint[point],COLOR_MAP_MAFIA);
- }
- }
- else
- {
- for(new i;i<MAX_PLAYERS;i++)
- {
- if(pData[i][FACTION]==pData[playerid][FACTION]) SendClientMessage(i,-1,"Failed takeover!");
- if(lastPointOwner[point]==pData[playerid][FACTION]) SendClientMessage(i,-1,"The attack has failed!");
- }
- takingPoint[point]=0;
- GangZoneStopFlashForAll(capturePoint[point]);
- }
- return 1;
- }
- stock StartCapture(playerid,point)
- {
- if(lastPointOwner[point]==pData[playerid][FACTION])return 0;
- if(IsPlayerInAnyVehicle(playerid))return 0;
- if(takingPoint[point]==0)
- {
- UpdatePointStatus(playerid,point,1);
- timer[point] = SetTimerEx("SetZone",30000,false,"ii",playerid,point);
- }
- return 1;
- }
- public SetZone(playerid,point)
- {
- if(GetPlayerState(playerid)==PLAYER_STATE_WASTED||IsPlayerInAnyVehicle(playerid))
- {
- if(ScanPointForAlly(playerid,point,0,0)==playerid)
- {
- UpdatePointStatus(playerid,point,0);
- return 0;
- }
- }
- GivePlayerMoney(ScanPointForAlly(playerid,point,1,1),1500);//double pay for solo capture
- GivePlayerMoney(playerid,1500);
- takingPoint[point]=0;
- lastPointOwner[point]=pData[playerid][FACTION];
- SendClientMessage(playerid, -1,"You've captured the zone and won $1500");
- new string[64];
- format(string,sizeof(string),"Capture Point %i has been taken over",point);
- SendClientMessageToAll(-1,string);
- GangZoneStopFlashForAll(point);
- switch(pData[playerid][FACTION])
- {
- case FACTION_BALLAS: GangZoneShowForAll(capturePoint[point],COLOR_MAP_BALLAS);
- case FACTION_GROVE: GangZoneShowForAll(capturePoint[point],COLOR_MAP_GROVE);
- case FACTION_AZTECAS: GangZoneShowForAll(capturePoint[point],COLOR_MAP_AZTECAS);
- case FACTION_MAFIA: GangZoneShowForAll(capturePoint[point],COLOR_MAP_MAFIA);
- }
- return 1;
- }
- stock IsPlayerInTurf(playerid)
- {
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- for(new i;i<TOTAL_STURFS;i++)if(x >= stXY[i][MIN_X] && x <= stXY[i][MAX_X] && y >= stXY[i][MIN_Y] && y <= stXY[i][MAX_Y])return 1;
- return 0;
- }
- stock ScanPointForAlly(playerid,point,entire,doReturn)
- {
- new Float:x,Float:y,Float:z;
- for(new i;i<MAX_PLAYERS;i++)
- {
- if(pData[playerid][FACTION]==pData[i][FACTION] && playerid!=i)
- {
- if(entire==0)
- {
- if(IsPlayerInRangeOfPoint(i,5,pPos[point][pX],pPos[point][pY],pPos[point][pZ]))
- {
- if(doReturn==1) return i;
- else return 1;
- }
- }
- else
- {
- GetPlayerPos(i,x,y,z);
- if(x >= cpXY[point][MIN_X] && x <= cpXY[point][MAX_X] && y >= cpXY[point][MIN_Y] && y <= cpXY[point][MAX_Y])
- {
- if(doReturn==1) return i;
- else return 1;
- }
- }
- }
- }
- return playerid;
- }
- //-------------------Y_INI functions----------------------------------
- public LoadpPos(tag[], name[], value[])
- {
- for(new i;i<TOTAL_CPOINTS;i++)
- {
- new temp[4];
- valstr(temp,i);
- if (!strcmp(tag, temp))
- {
- if (!strcmp(name, "x")) pPos[i][pX]=floatstr(value);
- if (!strcmp(name, "y")) pPos[i][pY]=floatstr(value);
- if (!strcmp(name, "z")) pPos[i][pZ]=floatstr(value);
- }
- }
- }
- public Loadstxy(tag[], name[], value[])
- {
- for(new i;i<TOTAL_STURFS;i++)
- {
- new temp[4];
- valstr(temp,i);
- if (!strcmp(tag, temp))
- {
- if (!strcmp(name, "minx")) stXY[i][MIN_X]=floatstr(value);
- if (!strcmp(name, "miny")) stXY[i][MIN_Y]=floatstr(value);
- if (!strcmp(name, "maxx")) stXY[i][MAX_X]=floatstr(value);
- if (!strcmp(name, "maxy")) stXY[i][MAX_Y]=floatstr(value);
- }
- }
- }
- public Loadcpxy(tag[], name[], value[])
- {
- for(new i;i<TOTAL_CPOINTS;i++)
- {
- new temp[4];
- valstr(temp,i);
- if (!strcmp(tag, temp))
- {
- if (!strcmp(name, "minx")) cpXY[i][MIN_X]=floatstr(value);
- if (!strcmp(name, "miny")) cpXY[i][MIN_Y]=floatstr(value);
- if (!strcmp(name, "maxx")) cpXY[i][MAX_X]=floatstr(value);
- if (!strcmp(name, "maxy")) cpXY[i][MAX_Y]=floatstr(value);
- }
- }
- }
- public LoadPlayerData(playerid,tag[],name[],value[])
- {
- new temp[4];
- if (!strcmp(tag, "Basic"))
- {
- if (!strcmp(name, "Faction")) pData[playerid][FACTION]=strval(value);
- if (!strcmp(name, "Class")) pData[playerid][CLASS]=strval(value);
- if (!strcmp(name, "HasPlayed")) pData[playerid][HASPLAYED]=strval(value);
- if (!strcmp(name, "Customized")) pData[playerid][CUSTOMIZED]=strval(value);
- }
- if(pData[playerid][CUSTOMIZED]==1)
- {
- if (!strcmp(tag, "Weapons"))
- {
- for(new i;i<=12;i++)
- {
- valstr(temp,i);
- if (!strcmp(name, temp)) pWeapons[playerid][i][0]=strval(value);
- }
- }
- if (!strcmp(tag, "Ammo"))
- {
- for(new i;i<=12;i++)
- {
- valstr(temp,i);
- if (!strcmp(name, temp)) pWeapons[playerid][i][1]=strval(value);
- }
- }
- }
- }
- public SavePlayerData(playerid)
- {
- new
- userFile[64],
- playerName[MAX_PLAYER_NAME],
- tempWeps[13][2],
- temp[13];
- GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
- format(userFile, sizeof (userFile), "planetside/Users/%s.ini", playerName);
- new
- INI:ini = INI_Open(userFile);
- //BASIC
- INI_SetTag(ini, "Basic");
- INI_WriteInt(ini, "Faction", pData[playerid][FACTION]);
- INI_WriteInt(ini, "Class", pData[playerid][CLASS]);
- INI_WriteInt(ini, "HasPlayed", pData[playerid][HASPLAYED]);
- INI_WriteInt(ini, "Customized", pData[playerid][CUSTOMIZED]);
- //WEAPONS&AMMO
- for(new i;i<=12;i++) GetPlayerWeaponData(playerid, i, tempWeps[i][0], tempWeps[i][1]);
- INI_SetTag(ini, "Weapons");
- for(new i;i<=12;i++)
- {
- valstr(temp,i);
- INI_WriteInt(ini, temp, tempWeps[i][0]);
- }
- INI_SetTag(ini, "Ammo");
- for(new i;i<=12;i++)
- {
- valstr(temp,i);
- INI_WriteInt(ini, temp, tempWeps[i][1]);
- }
- INI_Close(ini);
- }
- /*--------------------------------------------------------------
- ^^^^^^^^^^^^^^^
- END OF MY WORK
- ================================================================
- Rest is from wiki or forums
- vvvvvvvvvvvvvvvvv
- --------------------------------------------------------------*/
- stock SetPlayerSkinFix(playerid, skinid)
- {
- new
- Float:tmpPos[4],
- vehicleid = GetPlayerVehicleID(playerid),
- seatid = GetPlayerVehicleSeat(playerid);
- GetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
- GetPlayerFacingAngle(playerid, tmpPos[3]);
- if(skinid < 0 || skinid > 299) return 0;
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
- {
- SetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
- SetPlayerFacingAngle(playerid, tmpPos[3]);
- TogglePlayerControllable(playerid, 1);
- return SetPlayerSkin(playerid, skinid);
- }
- else if(IsPlayerInAnyVehicle(playerid))
- {
- new tmp;
- RemovePlayerFromVehicle(playerid);
- SetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
- SetPlayerFacingAngle(playerid, tmpPos[3]);
- TogglePlayerControllable(playerid, 1);
- tmp = SetPlayerSkin(playerid, skinid);
- PutPlayerInVehicle(playerid, vehicleid, (seatid == 128) ? 0 : seatid);
- return tmp;
- }
- else
- {
- return SetPlayerSkin(playerid, skinid);
- }
- }
- stock IsPlayerInWater(playerid)
- {
- new animlib[32],tmp[32];
- GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,tmp,32);
- if( !strcmp(animlib, "SWIM") && !IsPlayerInAnyVehicle(playerid) ) return 1;
- return 0;
- }
- //----------------------fin----------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment