30.04.2012, 17:22
Eu ao carregar na tecla do segundo rato, ele voa e morre.
Alguйm me pode ajudar??
Dou ++rep
Alguйm me pode ajudar??
Dou ++rep
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
if((PRESSED(KEY_UP) || PRESSED(KEY_DOWN) || PRESSED(KEY_LEFT) || PRESSED(KEY_RIGHT) && !(IsPlayerInAnyVehicle(playerid))))
{
new Float:x; new Float:y; new Float:z;
GetPlayerVelocity(playerid, x, y, z);
SetPlayerVelocity(playerid, x+7.5, y+7.5, z+7.5);
}
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && gSpectateID[playerid] != INVALID_PLAYER_ID)
{
if(newkeys == KEY_JUMP)
{
AdvanceSpectate(playerid);
}
else if(newkeys == KEY_SPRINT)
{
ReverseSpectate(playerid);
}
}
if((newkeys == KEY_FUMARBEBER))
{
if(IsSmoking[playerid] > 0)
{
IsSmoking[playerid] -= 1;
Fumar(playerid);
}
if(IsDrinking[playerid] > 0)
{
IsDrinking[playerid] -= 1;
Beber(playerid);
}
}
else if((newkeys == KEY_SPRINT))
{
OnPlayerCommandText(playerid,"/entrar");
OnPlayerCommandText(playerid,"/sair");
}
if((newkeys == KEY_MOTOR) && (IsPlayerInAnyVehicle(playerid)))
{
if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
{
OnPlayerCommandText(playerid,"/motor");
}
}
else if((newkeys == KEY_SECONDARY_ATTACK))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
{
SetTimerEx("mala2", 3*1000, false, "i", playerid);
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
new radares2 = radares[playerid];
KillTimer(radares2);
if(IsABike(GetPlayerVehicleID(playerid)))
{
if(PlayerInfo[playerid][pSeatBelt] == 1)
{
PlayerInfo[playerid][pSeatBelt] = 0;
PlayerActionMessage(playerid,15.0,"tira o capacete e pendura no espelho.");
}
return 1;
}
else if(IsPlayerInAnyVehicle(playerid) == 1)
{
if(PlayerInfo[playerid][pSeatBelt] == 1)
{
PlayerInfo[playerid][pSeatBelt] = 0;
PlayerActionMessage(playerid,15.0,"tira o cinto de seguranзa.");
}
return true;
}
}
}
//else if (PlayerInfo[playerid][pBebidaAlcolica] = 1){ PlayerInfo[playerid][pBebidaAlcolica] = 0; }
}
else if((newkeys == KEY_SECONDARY_ATTACK))
{
if (PlayerToPoint(2.0, playerid,361.6392,159.5206,1008.3828) || PlayerToPoint(2.0, playerid,374.8132,188.2278,1008.3893))
{
/*
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);*/
TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(playerid, 1);
}
}
if((PRESSED(KEY_UP) || PRESSED(KEY_DOWN) || PRESSED(KEY_LEFT) || PRESSED(KEY_RIGHT) && !(IsPlayerInAnyVehicle(playerid))))
{
new Float:x; new Float:y; new Float:z;
GetPlayerVelocity(playerid, x, y, z);
SetPlayerVelocity(playerid, x+7.5, y+7.5, z+7.5);
}
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
if((PRESSED(KEY_UP) || PRESSED(KEY_DOWN) || PRESSED(KEY_LEFT) || PRESSED(KEY_RIGHT) && !(IsPlayerInAnyVehicle(playerid))))
{
new Float:x; new Float:y; new Float:z;
GetPlayerVelocity(playerid, x, y, z);
SetPlayerVelocity(playerid, x+7.5, y+7.5, z+7.5);
}