SA-MP Forums Archive
Mind helping me? (Pro scripter) nevermind.. - 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: Mind helping me? (Pro scripter) nevermind.. (/showthread.php?tid=362883)



Mind helping me? (Pro scripter) nevermind.. - Rudy_ - 25.07.2012

Hey guys.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new currentveh;
            currentveh = GetPlayerVehicleID(playerid);
            new Float:vehx, Float:vehy, Float:vehz,Float:vehz_rot;
            GetVehiclePos(currentveh, vehx, vehy, vehz);
            CreateObject(18648,vehx , vehy, vehz, vehz_rot);
        }
    }
    return 1;
}
How can i create object id 18648 infront of player a little bit?
pawn Код:
CreateObject(18648,vehx , vehy, vehz, vehz_rot);
PS: I want to learn about Moving objects fast infront.
I guess it's Floatcos and Floatsin?
Thanks


Re: Mind helping me? (Pro scripter) nevermind.. - FireCat - 25.07.2012

No, GetXYInFrontOfPlayer


Re: Mind helping me? (Pro scripter) nevermind.. - Rudy_ - 25.07.2012

pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
      GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
How can this help me? in Moving the object fast or getting the cords?
Sorry new to this shit and it's night (mind fucked i guess so).
will this help me get the infront pos of player?


Re: Mind helping me? (Pro scripter) nevermind.. - FireCat - 25.07.2012

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new currentveh;
            currentveh = GetPlayerVehicleID(playerid);
            new Float:vehx, Float:vehy, Float:vehz,Float:vehz_rot;
            GetXYInFrontOfPlayer(playerid,vehx,vehy,5);
            CreateObject(18648,vehx , vehy, vehz, vehz_rot);
        }
    }
    return 1;
}
And put that GetXYInFrontOfPlayer at the end of your whole script


Re: Mind helping me? (Pro scripter) nevermind.. - Rudy_ - 25.07.2012

pawn Код:
CreateObject(18648,vehx , vehy, vehz, vehz_rot);
pawn Код:
CreateObject(modelif,X,Y,Z,rX,rY,rZ,Float:DrawDistance = 0.0)
Код:
C:\Users\Warkadang\Desktop\Scripting\Scripting\gamemodes\Derby.pwn(201) : warning 202: number of arguments does not match definition
C:\Users\Warkadang\Desktop\Scripting\Scripting\gamemodes\Derby.pwn(201) : warning 202: number of arguments does not match definition
C:\Users\Warkadang\Desktop\Scripting\Scripting\gamemodes\Derby.pwn(198) : warning 204: symbol is assigned a value that is never used: "currentveh"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:           1568 bytes
Code size:             2756 bytes
Data size:              520 bytes
Stack/heap size:      16384 bytes; estimated max. usage=28 cells (112 bytes)
Total requirements:   21228 bytes

3 Warnings.
Ehm...
Does it matter? i guess so
I know it'll be fixed after removing the veh_rotz, but i guess that is needed.


Re: Mind helping me? (Pro scripter) nevermind.. - TaLhA XIV - 25.07.2012

It does not matter,I also have a script having these warnings but they work fine.


Re: Mind helping me? (Pro scripter) nevermind.. - FireCat - 25.07.2012

Quote:
Originally Posted by TaLhA XIV
Посмотреть сообщение
It does not matter,I also have a script having these warnings but they work fine.
No its not alright, they are there for some reason, they should not be ignored.
It means you're not putting in some information.
Try putting ,0,0,0 after the vehz_rot


Re: Mind helping me? (Pro scripter) nevermind.. - Rudy_ - 25.07.2012

Fixed. but after removing currentveh
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new Float:vehx, Float:vehy, Float:vehz,Float:vehz_rot;
            GetXYInFrontOfPlayer(playerid,vehx,vehy,5);
            CreateObject(18648,vehx , vehy, vehz, vehz_rot,0,0,0);
        }
    }
    return 1;
}
PS: still looking for help floatsin and floatcos to speed move the object, darn it's 3:10 AM.


Re: Mind helping me? (Pro scripter) nevermind.. - Rudy_ - 25.07.2012

Even a tutorial to floatsin and floatcos would help.


Re: Mind helping me? (Pro scripter) nevermind.. - FireCat - 25.07.2012

And a tutorial on "How to not double post"