18.06.2010, 15:28
Da dar se vede peste tot... Uite filescriptu
![undecided](images/smilies/neutral.gif)
Code:
/*********************************** * Simple GPS System * * Version 1 * * Creator: Littlejohny * * Script by GTA-Scripting.tk * ************************************/ /* Thanks to Mabako for the Zones! */ #include <a_samp> new Text:gps[MAX_PLAYERS]; enum GPSInfo { zone_name[30], Float:zone_minx, Float:zone_miny, Float:zone_minz, Float:zone_maxx, Float:zone_maxy, Float:zone_maxz } new Float:Zones[][GPSInfo] = { { "Police Departament Turf.", 1497.47, -1737.13, -7.00, 1645.78, -1595.01, 200.00} }; new gMax; new GPS_Spawned[MAX_PLAYERS]; forward GPS(); public OnFilterScriptInit() { print("************************************"); print("* Simple GPS System *"); print("* Version 1 *"); print("* Creator: Littlejohny *"); print("* Script by GTA-Scripting.tk *"); print("************************************"); SetTimer("GPS", 500, 1); gMax = GetMaxPlayers(); for(new i=0; i<gMax; i++) { gps[i] = TextDrawCreate(501.000000,6.000000,"GPS"); TextDrawAlignment(gps[i],0); TextDrawBackgroundColor(gps[i],0x000000ff); TextDrawFont(gps[i],2); TextDrawLetterSize(gps[i],0.199999,1.100000); TextDrawColor(gps[i],0xffffffff); TextDrawSetOutline(gps[i],1); TextDrawSetProportional(gps[i],1); } return 1; } public OnFilterScriptExit() { print("************************************"); print("* Simple GPS System *"); print("* Version 1 *"); print("* Creator: Littlejohny *"); print("* Script by GTA-Scripting.tk *"); print("************************************"); return 1; } public OnPlayerConnect(playerid) { GPS_Spawned[playerid] = 0; return 1; } public OnPlayerSpawn(playerid) { GPS_Spawned[playerid] = 1; return 1; } public OnPlayerDeath(playerid,killerid,reason) { GPS_Spawned[playerid] = 0; return 1; } public GPS() { new str[256]; for(new i=0; i<gMax; i++) { if(IsPlayerConnected(i)) { if(GPS_Spawned[i] == 1) { format(str,sizeof(str),"%s", GetPlayerArea(i)); TextDrawSetString(gps[i], str); TextDrawShowForPlayer(i, gps[i]); } else { TextDrawHideForPlayer(i, gps[i]); } } } return 1; } stock GetPlayerArea(playerid) { new str[130]; format(str,sizeof(str),"%s",Zones[GetPlayerZone(playerid)][zone_name]); return str; } stock GetPlayerZone(playerid) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid,x,y,z); for(new i=0;i<sizeof(Zones);i++) { if(x > Zones[i][zone_minx] && y > Zones[i][zone_miny] && z > Zones[i][zone_minz] && x < Zones[i][zone_maxx] && y < Zones[i][zone_maxy] && z < Zones[i][zone_maxz]) return i; } return false; }