[Help] Setting an animation and timer in a FS. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] Setting an animation and timer in a FS. (
/showthread.php?tid=280913)
[Help] Setting an animation and timer in a FS. -
Da' J' - 03.09.2011
This is the part of the FS where i want SetTimer AND ApplyAnimation:
pawn Код:
//=================//
command(pickitem, playerid, params[])
{
for(new i = 0; i < sizeof(DropInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 2.0,DropInfo[i][DropGunPosX],DropInfo[i][DropGunPosY],DropInfo[i][DropGunPosZ]))
{
if(GetPlayerVirtualWorld(playerid) == DropInfo[i][DropGunVWorld] && GetPlayerInterior(playerid) == DropInfo[i][DropGunVWorld])
{
SetTimer("pickitem", 45000, false);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", Float:4, 0, 0, 0, 0, 0, 1);
GetPlayerName(playerid, sendername, sizeof(sendername));
DestroyDynamicObject(DropObject[i]);
DropInfo[i][DropGunPosX] = 0.0;
DropInfo[i][DropGunPosY] = 0.0;
DropInfo[i][DropGunPosZ] = 0.0;
DropInfo[i][DropGunAmmount][0] = 0;
DropInfo[i][DropGunAmmount][1] = 0;
GivePlayerWeapon(playerid,DropInfo[i][DropGunAmmount][0],DropInfo[i][DropGunAmmount][1]);
format(string, sizeof(string), "* %s picks up a weapon from the pavement.", sendername);
SendLocalMessage(playerid, string, 10.0, COLOR_ACTION, COLOR_ACTION);
}
}
}
return 1;
}
//=================//
With those sets, the FS is compiled correctly, loaded etc. But when i type /pickitem, the text appears in the screen normally, model dissepears from the ground. But, where's the gun? It won't come in my hand, no anim or SetTimer working :/
Re: [Help] Setting an animation and timer in a FS. -
Da' J' - 03.09.2011
Anyone knows how this works? Tried to change the line of the SetTimer and ApplyAnimation, but still not working...
AW: [Help] Setting an animation and timer in a FS. -
Joshua_Turnerz - 03.09.2011
well..your most obvious problem with not getting the weapon, is because your destroying the data before operating the function that gives based on the data
Quote:
DropInfo[i][DropGunAmmount][0] = 0; //<-- destroy data ?
DropInfo[i][DropGunAmmount][1] = 0; //<-- destroy data ?
GivePlayerWeapon(playerid,DropInfo[i][DropGunAmmount][0],DropInfo[i][DropGunAmmount][1]);//<-- So your giving 0 weapon ID and 0 ammo ... ( This is why you get nothing )
|
As for the animation, your using the wrong variables in the ApplyAnimation( See Wiki For Params )
Re: [Help] Setting an animation and timer in a FS. -
Da' J' - 03.09.2011
I don't want that if i drop down an M4 with 50 ammo and get a deagle with 1 ammo, lol. Where i should put the ApplyAnimation and SetTimer? To the botom of the part?