SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 08/11/2018, 02:40 AM   #1
Lucas-Fc
High-roller
 
Join Date: Sep 2012
Location: minha casa
Posts: 1,146
Reputation: 24
Default esse FS ainda funciona na versao do samp ?

peguei esse FS de voar , mais uso o cmd /fly aperto as teclas e nada acontece

ta funcionando ainda isso ?

https://forum.sa-mp.com/showthread.php?t=17645







Code:
#include <a_samp>

#define green 0x0AFF0AAA
#define red 0xFF0000FF

new fly[MAX_PLAYERS] = {0, 1};
new Float:x, Float:y, Float:z, Float:angle;

forward Float:GetXYInFrontOfPlayer(playerid, &Float:q, &Float:w, Float:distance);
forward Float:GetXYBehindPlayer(playerid, &Float:q, &Float:w, Float:distance);
forward FlyTimer();

main()
{
}

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("    Flying filterscript");
	print("    By Tornado");
	print("--------------------------------------\n");
	SetTimer("FlyTimer",100,1);
	return 1;
}

public OnPlayerConnect(playerid)
{
	fly[playerid] = 0;
	return 1;
}

public OnPlayerSpawn(playerid)
{
	fly[playerid] = 0;
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	fly[playerid] = 0;
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256];
	new idx;
	cmd = strtok(cmdtext, idx);

	if(strcmp(cmd, "/fly", true) == 0 && IsPlayerAdmin(playerid)) {
		new tmp[256];
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) { if(fly[playerid] == 1) { fly[playerid] = 0; SendClientMessage(playerid,red,"Fly mode offline."); TogglePlayerControllable(playerid,true); return 1; } else if(fly[playerid] == 0) { fly[playerid] = 1; SendClientMessage(playerid,green,"Fly mode online."); TogglePlayerControllable(playerid,false); return 1; } }
		if(strcmp(tmp, "on", true) == 0) { fly[playerid] = 1; SendClientMessage(playerid,green,"Fly mode online."); TogglePlayerControllable(playerid,false); return 1; }
		else if(strcmp(tmp, "off", true) == 0) { fly[playerid] = 0; SendClientMessage(playerid,red,"Fly mode offline."); TogglePlayerControllable(playerid,true); return 1; }
	}
	return 0;
}

Float:GetXYInFrontOfPlayer(playerid, &Float:q, &Float:w, Float:distance)
{
	new Float:a;
	GetPlayerPos(playerid, q, w, a);
	if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	else GetPlayerFacingAngle(playerid, a);
	q += (distance * floatsin(-a, degrees));
	w += (distance * floatcos(-a, degrees));
	return a;
}

Float:GetXYBehindPlayer(playerid, &Float:q, &Float:w, Float:distance)
{
	new Float:a;
	GetPlayerPos(playerid, q, w, a);
	if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	else GetPlayerFacingAngle(playerid, a);
	q += (distance * -floatsin(-a, degrees));
	w += (distance * -floatcos(-a, degrees));
	return a;
}

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}

public FlyTimer()
{
	new keys, updown, leftright;
	for(new playerid=0;playerid<MAX_PLAYERS;playerid++) {
		if(IsPlayerConnected(playerid)) {
			if(fly[playerid] == 1) {
				GetPlayerKeys(playerid,keys,updown,leftright);
				if(updown == KEY_UP) {
					if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
						GetPlayerPos(playerid, x, y, z);
						GetXYInFrontOfPlayer(playerid, x, y, 5.0);
						SetPlayerPos(playerid, x, y, z);
						SetCameraBehindPlayer(playerid);
					}
					else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
						new playercar = GetPlayerVehicleID(playerid);
						GetVehiclePos(playercar, x, y, z);
						GetXYInFrontOfPlayer(playerid, x, y, 5.0);
						SetVehiclePos(playercar, x, y, z);
					}
				}
				else if(updown == KEY_DOWN) {
					if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
						GetPlayerPos(playerid, x, y, z);
						GetXYBehindPlayer(playerid, x, y, 5.0);
						SetPlayerPos(playerid, x, y, z);
						SetCameraBehindPlayer(playerid);
					}
					else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
						new playercar = GetPlayerVehicleID(playerid);
						GetVehiclePos(playercar, x, y, z);
						GetXYBehindPlayer(playerid, x, y, 5.0);
						SetVehiclePos(playercar, x, y, z);
					}
				}
				if(leftright == KEY_LEFT) {
					if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
						GetPlayerFacingAngle(playerid, angle);
						SetPlayerFacingAngle(playerid, angle+10);
						SetCameraBehindPlayer(playerid);
					}
					else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
						new playercar = GetPlayerVehicleID(playerid);
						GetVehicleZAngle(playercar, angle);
						SetVehicleZAngle(playercar, angle+10);
					}
				}
				else if(leftright == KEY_RIGHT) {
					if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
						GetPlayerFacingAngle(playerid, angle);
						SetPlayerFacingAngle(playerid, angle-10);
						SetCameraBehindPlayer(playerid);
					}
					else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
						new playercar = GetPlayerVehicleID(playerid);
						GetVehicleZAngle(playercar, angle);
						SetVehicleZAngle(playercar, angle-10);
					}
				}
				if(keys == KEY_JUMP) {
					if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
						GetPlayerPos(playerid, x, y, z);
						SetPlayerPos(playerid, x, y, z+5);
						SetCameraBehindPlayer(playerid);
					}
					else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
						new playercar = GetPlayerVehicleID(playerid);
						GetVehiclePos(playercar, x, y, z);
						SetVehiclePos(playercar, x, y, z+5);
					}
				}
				else if(keys == KEY_SPRINT) {
					if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
						GetPlayerPos(playerid, x, y, z);
						SetPlayerPos(playerid, x, y, z-5);
						SetCameraBehindPlayer(playerid);
					}
					else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
						new playercar = GetPlayerVehicleID(playerid);
						GetVehiclePos(playercar, x, y, z);
						SetVehiclePos(playercar, x, y, z-5);
					}
				}
			}
		}
	}
}
Lucas-Fc is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] alguem pode me dizer por que esse codigo não funciona Santso Português/Portuguese 9 14/02/2018 09:29 PM
[Ajuda] Como rodar GM'S de uma versão em outra versão do samp OverKiller Português/Portuguese 4 17/03/2016 04:39 PM
[Off] Qual host ainda funciona ? RussoTDM Português/Portuguese 44 23/12/2014 07:10 PM
[Ajuda] qual versão 3z funciona? RogerMP Português/Portuguese 2 22/03/2014 11:59 AM
[Ajuda] Esse código funciona? Juniiro3 Português/Portuguese 4 24/07/2013 11:26 PM


All times are GMT. The time now is 02:27 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.