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



Little Help - Sanady - 30.03.2014

Hello everybody I want to create simple granade launcher..But object does not appears I don`t know why here is code
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(GranadeLaucher[playerid] == 1)
    {
        new Float:X,Float:Y,Float:Z;
        Object1 = CreateObject(342, X,Y,Z, 0, 0, 180);//toto nacim on player shoot
        CreateExplosion(fX, fY, fZ, 3, 15.0);
        GetPlayerLastShotVectors(playerid, X, Y, Z, fX, fY, fZ);
        MoveObject(Object1,fX,fY,fZ,1.0,0,0,0);
    }
    return 1;
}
Can you check?


Re: Little Help - BroZeus - 30.03.2014

the createobject line has x y and z which have not been assigned any value thats why object is not creating
and also it should give a warning that x y and z has not assigned a value while compiling


Re: Little Help - EiresJason - 30.03.2014

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(GranadeLaucher[playerid] == 1)
    {
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid,X,Y,Z);//forgot this? :P
        Object1 = CreateObject(342, X,Y,Z, 0, 0, 180);//toto nacim on player shoot
        CreateExplosion(fX, fY, fZ, 3, 15.0);
        GetPlayerLastShotVectors(playerid, X, Y, Z, fX, fY, fZ);
        MoveObject(Object1,fX,fY,fZ,1.0,0,0,0);
    }
    return 1;
}
@ BroZeus

They would be set as 0.0 :P