12.04.2012, 18:25
Olб amigos eu queria que o sistema abaixo fosse da seguinte maneira: O player digita-se /taser e aparece-se: Oficial Matheus_Ecko retirou o taser do seu coldre e em seguida aparece-se uma SD Pistol (Pistola com Silenciador) dai ele ganha-se 3 balas para sua arma e caso acaba-se os tiros apareceria: Acabou as suas cargas de taser (/rtaser) dai ele digita /rtaser e guardava a taser no coldre se puderem me ajudar eu agradeзo.
pawn Код:
#define FILTERSCRIPT
//==============================================================================
#include <a_samp>
//==============================================================================
#define TASER_TEMPO 5000
#define ARMA 23
#define R_SOUND 50.0
#define WHITE -1
#define YELLOW 0xFFFF00AA
//==============================================================================
new ContinueTaser[MAX_PLAYERS];
//==============================================================================
forward GetClosestPlayer(p1);
forward Float:GetDistanceBetweenPlayers(p1,p2);
//==============================================================================
main()
{
}
//==============================================================================
public OnPlayerConnect(playerid)
{
ContinueTaser[playerid] = 0;
return 1;
}
//==============================================================================
public OnPlayerDisconnect(playerid, reason)
{
ContinueTaser[playerid] = 0;
return 1;
}
//==============================================================================
public OnPlayerSpawn(playerid)
{
ContinueTaser[playerid] = 0;
return 1;
}
//==============================================================================
public OnPlayerDeath(playerid, killerid, reason)
{
ContinueTaser[playerid] = 0;
return 1;
}
//==============================================================================
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE) // If you push left click you're gonna play the taser.
{
new victimid = GetClosestPlayer(playerid);
if(IsPlayerConnected(victimid))
{
if(ContinueTaser[playerid] == 1)
{
TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(victimid, 0);
ContinueTaser[playerid] = 1;
SendClientMessage(playerid, WHITE, "You used your {FFCC33}taser{FFFFFF} again!");
SendClientMessage(playerid, YELLOW, "You can continue to shoot the taser and the victim will return to receive electricity.");
SendClientMessage(victimid, WHITE, "You have received again a {FFCC33}taser{FFFFFF} dart!");
ApplyAnimation(victimid,"PED","KO_skid_front",4.1,0,1,1,1,0);
ApplyAnimation(victimid,"PED","KO_skid_front",4.1,0,1,1,1,0);
SetTimerEx("TaserTime", TASER_TEMPO, 0, "d", victimid);
SetTimerEx("StopTaser", TASER_TEMPO, 0, "d", playerid);
}
}
return 1;
}
return 1;
}
//==============================================================================
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
new Float:Chaleco, Float:Vida; GetPlayerArmour(playerid, Chaleco); GetPlayerHealth(playerid, Vida);
if(weaponid == ARMA)
{
if(IsPlayerInAnyVehicle(playerid))
{
return 1;
}
GameTextForPlayer(playerid, "~r~paralyzed by the taser again", TASER_TEMPO, 3);
TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(issuerid, 0);
ContinueTaser[issuerid] = 1;
new Float:Audio_X, Float:Audio_Y, Float:Audio_Z;
GetPlayerPos(playerid, Audio_X, Audio_Y, Audio_Z);
StopAudioStreamForPlayer(playerid);
PlayAudioStreamForPlayer(playerid, "http://k004.kiwi6.com/hotlink/9s19772cbe/taser_sound.mp3", Audio_X, Audio_Y, Audio_Z, R_SOUND, 1);
SendClientMessage(issuerid, WHITE, "You used your {FFCC33}taser{FFFFFF}!");
SendClientMessage(issuerid, YELLOW, "You can continue to shoot the taser and the victim will return to receive electricity.");
SendClientMessage(playerid, WHITE, "You have received {FFCC33}taser{FFFFFF} dart!");
ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
SetTimerEx("TaserTime", TASER_TEMPO, 0, "d", playerid);
SetTimerEx("StopTaser", TASER_TEMPO, 0, "d", issuerid);
}
}
return 1;
}
//==============================================================================
forward TaserTime(playerid);
public TaserTime(playerid)
{
TogglePlayerControllable(playerid, 1);
ClearAnimations(playerid);
return 1;
}
//==============================================================================
forward StopTaser(playerid);
public StopTaser(playerid)
{
TogglePlayerControllable(playerid, 1);
ClearAnimations(playerid);
ContinueTaser[playerid] = 0;
return 1;
}
//==============================================================================
public GetClosestPlayer(p1)
{
new x,Float:dis,Float:dis2,player2;
player2 = -1;
dis = 99999.99;
for (x=0;x<MAX_PLAYERS;x++)
{
if(IsPlayerConnected(x))
{
if(x != p1)
{
dis2 = GetDistanceBetweenPlayers(x,p1);
if(dis2 < dis && dis2 != -1.00)
{
dis = dis2;
player2 = x;
}
}
}
}
return player2;
}
//==============================================================================
public Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
//==============================================================================