Jump to content
  • 0

ajutor gps


cr3azy

Question

am bagat si eu acest sistem de gps... dar cand dau f5 nu imi apare nimic ... nici erori nici nimic..

new GPSTimer[MAX_PLAYERS];
new bool:HaveGPS[MAX_PLAYERS];
forward GPSUpdate(playerid,playerid2);
public GPSUpdate(playerid,playerid2){
	if(IsPlayerConnected(playerid2)){
		new Float:Distnace;
		Distnace = GetDistanceBetweenPlayers(playerid,playerid2);
		new Float:X,Float:Y,Float:Z;
		GetPlayerPos(playerid2,X,Y,Z);
		DisablePlayerCheckpoint(playerid);
		SetPlayerCheckpoint(playerid,X,Y,Z,0.1);
		new string[128];
		format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~p~Distance: ~r~%.1f ~y~m",Distnace);
		GameTextForPlayer(playerid, string, 1100, 5);
		if(Distnace <= 4.0) {
			DisablePlayerCheckpoint(playerid);
			KillTimer(GPSTimer[playerid]);
			HaveGPS[playerid] = false;
			GPSTimer[playerid] = 0;
		}
	}else{
		DisablePlayerCheckpoint(playerid);
		KillTimer(GPSTimer[playerid]);
		HaveGPS[playerid] = false;
		GPSTimer[playerid] = 0;
		SendClientMessage(playerid, 0xFF0000AA, "SERVER: Player disconnected.");
	}
	return 1;
}
public OnPlayerConnect(playerid)
{
	GPSTimer[playerid] = 0;
	HaveGPS[playerid] = false;
	SendClientMessage(playerid, 0xFFFFFFAA, "This server is running GPS by Jefff (/gps)");
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	if(HaveGPS[playerid]) {
		KillTimer(GPSTimer[playerid]);
		HaveGPS[playerid] = false;
		GPSTimer[playerid] = 0;
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	if(HaveGPS[playerid]) {
		KillTimer(GPSTimer[playerid]);
		HaveGPS[playerid] = false;
		GPSTimer[playerid] = 0;
	}
	return 1;
}
new cmd[64],tmp[64],idx;
	cmd = strtok(cmdtext,idx);
	if(!strcmp(cmd, "/gps", true))
	{
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFAA, "Usage: /gps [playerid / off]");
		if(!strcmp(tmp, "off", true)) {
			if(HaveGPS[playerid]) {
				KillTimer(GPSTimer[playerid]);
				HaveGPS[playerid] = false;
				GPSTimer[playerid] = 0;
				DisablePlayerCheckpoint(playerid);
				SendClientMessage(playerid, 0xFFFF00AA, "SERVER: GPS disabled.");
			}else SendClientMessage(playerid, 0xFF0000AA, "SERVER: Your GPS isnt turned ON !");
			return 1;
		}
		if(IsPlayerConnected(strval(tmp))) {
			if(strval(tmp) != playerid) {
				if(HaveGPS[playerid]) {
					KillTimer(GPSTimer[playerid]);
					HaveGPS[playerid] = false;
					GPSTimer[playerid] = 0;
				}
				GPSTimer[playerid] = SetTimerEx("GPSUpdate", 500, true, "dd", playerid,strval(tmp));
				HaveGPS[playerid] = true;
				new str[128],nick[24];
				GetPlayerName(strval(tmp),nick,24);
				format(str,128,"SERVER: GPS enabled. Target: %s (ID: %d)",nick,strval(tmp));
				SendClientMessage(playerid, 0xFFFF00AA, str);
			}else SendClientMessage(playerid, 0xFF0000AA, "SERVER: You cant type your own ID !");
		}else SendClientMessage(playerid, 0xFF0000AA, "SERVER: This ID isnt connected !");
		return 1;
	}
	return 0;
}

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.