CMD won't work..
#1

Hello everyone, I am recently working on a new gamemode, and I am stuck with a weird problem.
I am kind of new to scripting, but I get this code to compile without any errors, tho it does WORK for the teamid 2 (zombies), but if I use the command, as a team 1 player, I won't see the SendClientMessage..

pawn Code:
CMD:powers(playerid, params[])
{
    if(GetPlayerTeam(playerid) == 2)
    {
        if(Flaming[playerid] == 0)
        {
            Flaming[playerid] = 1;
            SetPlayerAttachedObject( playerid, 0, 18693, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
            SetPlayerAttachedObject( playerid, 1, 18693, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
            SetPlayerAttachedObject( playerid, 2, 18703, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
            SetPlayerAttachedObject( playerid, 3, 18703, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );

            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can now use your supers powers!");
        }
        else if(Flaming[playerid] == 1)
        {
            Flaming[playerid] = 0;

            for ( new i = 0; i < 4; i++ )
            if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
            RemovePlayerAttachedObject( playerid, i );

        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "[TEAM] {FFFFFF}- You're not a zombie, so you do not have super powers!");
        }
    }
    return 1;
}

And another question is, how can I get the player to create explosions everytime he punches (mouse 1), and how is it possible to make him run faster than the regular? If it is at all..

Thanks in advance!
Reply
#2

You're else'ing at the wrong close bracket, here:

pawn Code:
CMD:powers(playerid, params[])
{
    if(GetPlayerTeam(playerid) == 2)
    {
        if(Flaming[playerid] == 0)
        {
            Flaming[playerid] = 1;
            SetPlayerAttachedObject( playerid, 0, 18693, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
            SetPlayerAttachedObject( playerid, 1, 18693, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
            SetPlayerAttachedObject( playerid, 2, 18703, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
            SetPlayerAttachedObject( playerid, 3, 18703, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );

            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can now use your supers powers!");
        }
        else if(Flaming[playerid] == 1)
        {
            Flaming[playerid] = 0;

            for ( new i = 0; i < 4; i++ )
            if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
            RemovePlayerAttachedObject( playerid, i );

        }
        return 1;
    }
    else { SendClientMessage(playerid, COLOR_RED, "[TEAM] {FFFFFF}- You're not a zombie, so you do not have super powers!"); return 1; }
}
Reply
#3

Quote:
Originally Posted by DanishHaq
View Post
You're else'ing at the wrong close bracket, here:

pawn Code:
CMD:powers(playerid, params[])
{
    if(GetPlayerTeam(playerid) == 2)
    {
        if(Flaming[playerid] == 0)
        {
            Flaming[playerid] = 1;
            SetPlayerAttachedObject( playerid, 0, 18693, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
            SetPlayerAttachedObject( playerid, 1, 18693, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
            SetPlayerAttachedObject( playerid, 2, 18703, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
            SetPlayerAttachedObject( playerid, 3, 18703, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );

            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can now use your supers powers!");
        }
        else if(Flaming[playerid] == 1)
        {
            Flaming[playerid] = 0;

            for ( new i = 0; i < 4; i++ )
            if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
            RemovePlayerAttachedObject( playerid, i );

        }
        return 1;
    }
    else { SendClientMessage(playerid, COLOR_RED, "[TEAM] {FFFFFF}- You're not a zombie, so you do not have super powers!"); return 1; }
}
Oh, my bad, hehe. Well anyways, can you help me out with the second question?
Reply
#4

To make an explosion when the player presses KEY_FIRE or Left Mouse Button you need this code
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        new Float:PosX, Float: PosY, Float: PosZ;
        GetPlayerPos(playerid, PosX, PosY, PosZ);
        CreateExplosion(PosX, PosY, PosZ, 0, 5.0);
    }
    return 1;
}
&


If you don't have this code, this code makes all skin run fast like CJ
pawn Code:
//OnGameModeInit
UsePlayerPedAnims();
Reply
#5

Quote:
Originally Posted by pds2012
View Post
To make an explosion when the player presses KEY_FIRE or Left Mouse Button you need this code
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        new Float:PosX, Float: PosY, Float: PosZ;
        GetPlayerPos(playerid, PosX, PosY, PosZ);
        CreateExplosion(PosX, PosY, PosZ, 0, 5.0);
    }
    return 1;
}
&


If you don't have this code, this code makes all skin run fast like CJ
pawn Code:
//OnGameModeInit
UsePlayerPedAnims();
Well, that creates an explosion on my player, and I need it to be a few meters from him.
And I have that, I mean running faster, like after taking an adrenaline pill.

EDIT: There is no explosion at all, it just light my player on fire lol.
Reply
#6

Try these experiment, and tell me if it works

pawn Code:
CreateExplosion(PosX, PosY, PosZ, 0, 5.0+10.0);
Reply
#7

To make change players velocity you should use
pawn Code:
SetPlayerVelocity
And if you want to create an explosion, that it's just fire you should search in the wiki for the explosions styles and take a look for the explosion description.
Reply
#8

Quote:
Originally Posted by pds2012
View Post
Try these experiment, and tell me if it works

pawn Code:
CreateExplosion(PosX, PosY, PosZ, 0, 5.0+10.0);
Nope, didn't work..


Quote:
Originally Posted by PabloDiCostanzo
View Post
To make change players velocity you should use
pawn Code:
SetPlayerVelocity
And if you want to create an explosion, that it's just fire you should search in the wiki for the explosions styles and take a look for the explosion description.
Yeah, that's what I was looking for , thanks!
Reply
#9

Ahh the explosion happens behind the player because they are running ?
Reply
#10

Quote:
Originally Posted by [uL]Pottus
View Post
Ahh the explosion happens behind the player because they are running ?
Nope, even if I am standing still, the explosion is created on myself, I need it to be a few meters infront..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)