SA-MP Forums Archive
Actor Help - 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: Actor Help (/showthread.php?tid=628277)



Actor Help - aoky - 08.02.2017

How can I add it so when the player gets hit it adds an actor to his position?
Quote:

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(weaponid == SLAP_GUN && issuerid == DildoSlapper)
{
GameTextForPlayer(playerid, "~r~DEAD~w~!", 3000, 5);
GameTextForPlayer(playerid, "~g~KILLED~w~!", 3000, 5);

Dead[playerid] = true;
currDead++;
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer(playerid, issuerid, SPECTATE_MODE_NORMAL);
if(currDead == (FixPlayers() - 1))
{
EndGame();
}
}
return;
}

Thanks, and I apologize for all the posts. I'm new to all this scripting stuff.


Re: Actor Help - Eoussama - 08.02.2017

Use GetPlayerPos and stop the player position on variables (Float type),
then CreateActor on the same Location
PHP код:

public OnPlayerTakeDamage(playeridissueridFloat:amountweaponid)
{
    new 
Float:Pos[3];
    if(
weaponid == SLAP_GUN && issuerid == DildoSlapper)
    {
        
GameTextForPlayer(playerid"~r~DEAD~w~!"30005);
        
GameTextForPlayer(playerid"~g~KILLED~w~!"30005);
        
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
        
CreateActor(250Pos[0], Pos[1], Pos[2], 0.0);
        
Dead[playerid] = true;
        
currDead++;
        
TogglePlayerSpectating(playeridtrue);
        
PlayerSpectatePlayer(playeridissueridSPECTATE_MODE_NORMAL);
        if(
currDead == (FixPlayers() - 1))
        {
            
EndGame();
        }
    }
    return;




Re: Actor Help - GoldenLion - 08.02.2017

Get player's position using GetPlayerPos then create an actor at the coordinates returned using CreateActor.
Код:
new Float:x, Float:y, Float:z;

GetPlayerPos(playerid, x, y, z);
CreateActor(skinid, x, y, z);



Re: Actor Help - aoky - 08.02.2017

Rep'd both of you, thanks for the help. By the way, would this work since I want to add an animation?
Quote:

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new Float:Pos[3];
if(weaponid == SLAP_GUN && issuerid == DildoSlapper)
{
GameTextForPlayer(playerid, "~r~DEAD~w~!", 3000, 5);
GameTextForPlayer(playerid, "~g~KILLED~w~!", 3000, 5);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
CreateActor(296, Pos[0], Pos[1], Pos[2], 0.0);
ApplyActorAnimation(296, "WUZI", "CS_Dead_Guy",1.0, 0, 1, 1, 1, 0);
Dead[playerid] = true;
currDead++;
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer(playerid, issuerid, SPECTATE_MODE_NORMAL);
if(currDead == (FixPlayers() - 1))
{
EndGame();
}
}
return;
}




Re: Actor Help - aoky - 08.02.2017

Quote:
Originally Posted by aoky
Посмотреть сообщение
Rep'd both of you, thanks for the help. By the way, would this work since I want to add an animation?
Код HTML:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    new Float:Pos[3];
    if(weaponid == SLAP_GUN && issuerid == DildoSlapper)
    {
        GameTextForPlayer(playerid, "~r~DEAD~w~!", 3000, 5);
        GameTextForPlayer(playerid, "~g~KILLED~w~!", 3000, 5);
        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        CreateActor(296, Pos[0], Pos[1], Pos[2], 0.0);
        ApplyActorAnimation(MyActor, "WUZI", "CS_Dead_Guy",1.0, 0, 1, 1, 1, 0);
        Dead[playerid] = true;
        currDead++;
        TogglePlayerSpectating(playerid, true);
        PlayerSpectatePlayer(playerid, issuerid, SPECTATE_MODE_NORMAL);
        if(currDead == (FixPlayers() - 1))
        {
            EndGame();
        }
    }
    return;
}
That doesn't work sadly


Re: Actor Help - Eoussama - 08.02.2017

Quote:
Originally Posted by aoky
Посмотреть сообщение
[HTML]public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)

That doesn't work sadly
What is the problem?
The animation? The actor does not spawn?


Re: Actor Help - aoky - 08.02.2017

The animation doesn't work!


Re: Actor Help - Eoussama - 08.02.2017

OK, put this as a global variable pActor[MAX_PLAYERS];
PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponid)
{
    new 
Float:Pos[3];
    if(
weaponid == SLAP_GUN && issuerid == DildoSlapper)
    {
        
GameTextForPlayer(playerid"~r~DEAD~w~!"30005);
        
GameTextForPlayer(playerid"~g~KILLED~w~!"30005);
        
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
        
pActor[playerid] = CreateActor(296Pos[0], Pos[1], Pos[2], 0.0);
        
ApplyActorAnimation(pActor[playerid], "WUZI""CS_Dead_Guy",1.001110);
        
Dead[playerid] = true;
        
currDead++;
        
TogglePlayerSpectating(playeridtrue);
        
PlayerSpectatePlayer(playeridissueridSPECTATE_MODE_NORMAL);
        if(
currDead == (FixPlayers() - 1))
        {
            
EndGame();
        }
    }
    return;




Re: Actor Help - aoky - 08.02.2017

Quote:

C:\Users\Aoky\Desktop\dildo.pwn(219) : error 017: undefined symbol "pActor"
C:\Users\Aoky\Desktop\dildo.pwn(219) : warning 215: expression has no effect
C:\Users\Aoky\Desktop\dildo.pwn(219) : error 001: expected token: ";", but found "]"
C:\Users\Aoky\Desktop\dildo.pwn(219) : error 029: invalid expression, assumed zero
C:\Users\Aoky\Desktop\dildo.pwn(219) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

I get these errors now.

Here is the lines 211-231
Quote:

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new Float:Pos[3];
if(weaponid == SLAP_GUN && issuerid == DildoSlapper)
{
GameTextForPlayer(playerid, "~r~DEAD~w~!", 3000, 5);
GameTextForPlayer(playerid, "~g~KILLED~w~!", 3000, 5);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
pActor[playerid] = CreateActor(296, Pos[0], Pos[1], Pos[2], 0.0);
ApplyActorAnimation(pActor[playerid], "WUZI", "CS_Dead_Guy",1.0, 0, 1, 1, 1, 0);
Dead[playerid] = true;
currDead++;
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer(playerid, issuerid, SPECTATE_MODE_NORMAL);
if(currDead == (FixPlayers() - 1))
{
EndGame();
}
}
return;
}




Re: Actor Help - Eoussama - 08.02.2017

Put this under your includes
PHP код:
new pActor[MAX_PLAYERS];