SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 10/05/2012, 10:46 AM   #31
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,915
Reputation: 315
Default Re: SetPlayerPosEx

Quote:
Originally Posted by Grimrandomer View Post
Problem here is if they are in a vehicle, the vehicle is moved but they are not

pawn Code:
stock SetPlayerPosEx(playerid, Float:x, Float:y, Float:z, Float:a = -1.0, interior = -1, vw = -1)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new vehicleid=GetPlayerVehicleID(playerid);
        SetVehiclePos(vehicleid,x,y,z);
        if(a == -1.0) GetVehicleZAngle(vehicleid, a);
        SetVehicleZAngle(vehicleid,a);
        if(interior == -1) interior = GetPlayerInterior(playerid);
        LinkVehicleToInterior(vehicleid, interior);
        if(vw == -1) vw = GetVehicleVirtualWorld(vehicleid);
        SetVehicleVirtualWorld(vehicleid, vw);
    }
    else {
        SetPlayerPos(playerid, x, y, z);
        if(a == -1.0) GetPlayerFacingAngle(playerid, a);
        SetPlayerFacingAngle(playerid, a);
    }
    if(interior == -1) interior = GetPlayerInterior(playerid);
    SetPlayerInterior(playerid, interior);
    if(vw == -1) vw = GetPlayerVirtualWorld(playerid);
    SetPlayerVirtualWorld(playerid, vw);

    return 1;
}

This way, IF they are in a vehicle the vehicle is moved
Thats an interesting one. Good work mate. Allright I will test it if everything work's cool , I will use that for the version 2.0 of this include. Will give you credits. Added Rep+3.
__________________
I successfully reset password for my account and retrieved it after a few months.

I am back on work!



I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 10/05/2012, 11:11 AM   #32
Verbal
Big Clucker
 
Join Date: May 2012
Location: Behind You
Posts: 83
Reputation: 3
Default Re: SetPlayerPosEx

Nice, but I personally think it's useless to download and use an include, when you can just add this stock to your script .
__________________
Moved to another account - CptK.
Verbal is offline   Reply With Quote
Old 10/05/2012, 04:00 PM   #33
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,915
Reputation: 315
Default Re: SetPlayerPosEx

Quote:
Originally Posted by Verbal View Post
Nice, but I personally think it's useless to download and use an include, when you can just add this stock to your script .
Do it that way. I dont care. I think the processing speed will be faster when using it as an include. Keep my credits if you want to use it that way.
__________________
I successfully reset password for my account and retrieved it after a few months.

I am back on work!



I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 10/05/2012, 04:08 PM   #34
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 18,432
Reputation: 2600
Default Re: SetPlayerPosEx

Quote:
Originally Posted by Ballu Miaa View Post
Do it that way. I dont care. I think the processing speed will be faster when using it as an include.
Nope
Y_Less is offline   Reply With Quote
Old 10/05/2012, 04:13 PM   #35
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,915
Reputation: 315
Default Re: SetPlayerPosEx

Quote:
Originally Posted by Y_Less View Post
Nope
Allright thanks for clearing up the fact SA-MP Savior Y_Less . I hope i could rep you again lol.
__________________
I successfully reset password for my account and retrieved it after a few months.

I am back on work!



I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 10/05/2012, 04:13 PM   #36
fiki574
Gangsta
 
fiki574's Avatar
 
Join Date: Mar 2011
Location: Croatia
Posts: 822
Reputation: 151
Default Re: SetPlayerPosEx

Nice work!

My example:
pawn Code:
stock SetPlayerPosEx(playerid,Float:X,Float:Y,Float:Z,Float:Angle,virtualworld=0,interior=0,gametext[],message[],msgcolor,bool:vehicle)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(bool:vehicle == true)
        {
            SetPlayerVirtualWorld(playerid,virtualworld);
            SetPlayerInterior(playerid,interior);
            LinkVehicleToInterior(GetPlayerVehicleID(playerid),0);
            SetVehiclePos(GetPlayerVehicleID(playerid),Float:X,Float:Y,Float:Z);
            SetVehicleZAngle(GetPlayerVehicleID(playerid),Float:Angle);
            SetCameraBehindPlayer(playerid);
            new gtext[100];
            format(gtext,sizeof(gtext),"~g~WELCOME TO ~n~~w~%s",gametext);
            GameTextForPlayer(playerid,gtext,3000,3);
            new msg[256];
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pname, sizeof(pname));
            format(msg, sizeof(msg), "%s has teleported to %s", pname, message);
            SendClientMessageToAll(msgcolor, msg);
        }
    }
    else
    {
        SetPlayerVirtualWorld(playerid,virtualworld);
        SetPlayerInterior(playerid,interior);
        SetPlayerPos(playerid,Float:X,Float:Y,Float:Z);
        SetPlayerFacingAngle(playerid, Float:Angle);
        SetCameraBehindPlayer(playerid);
        new gtext[100];
        format(gtext,sizeof(gtext),"~g~WELCOME TO ~n~~w~%s",gametext);
        GameTextForPlayer(playerid,gtext,3000,3);
        new msg[256];
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
        format(msg, sizeof(msg), "%s has teleported to %s", pname, message);
        SendClientMessageToAll(msgcolor, msg);
    }
    return 1;
}
__________________

If you need any help with anything related to SAMP and/or scripting/programming, feel free to PM me!
I am scripting/programming for money (very low prices, from $5 to $15 or more, price depends on complexity)
fiki574 is offline   Reply With Quote
Old 10/05/2012, 04:17 PM   #37
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,915
Reputation: 315
Default Re: SetPlayerPosEx

Quote:
Originally Posted by fiki574_CRO View Post
Nice work!

My example:
pawn Code:
stock SetPlayerPosEx(playerid,Float:X,Float:Y,Float:Z,Float:Angle,virtualworld=0,interior=0,gametext[],message[],msgcolor,bool:vehicle)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(bool:vehicle == true)
        {
            SetPlayerVirtualWorld(playerid,virtualworld);
            SetPlayerInterior(playerid,interior);
            LinkVehicleToInterior(GetPlayerVehicleID(playerid),0);
            SetVehiclePos(GetPlayerVehicleID(playerid),Float:X,Float:Y,Float:Z);
            SetVehicleZAngle(GetPlayerVehicleID(playerid),Float:Angle);
            SetCameraBehindPlayer(playerid);
            new gtext[100];
            format(gtext,sizeof(gtext),"~g~WELCOME TO ~n~~w~%s",gametext);
            GameTextForPlayer(playerid,gtext,3000,3);
            new msg[256];
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pname, sizeof(pname));
            format(msg, sizeof(msg), "%s has teleported to %s", pname, message);
            SendClientMessageToAll(msgcolor, msg);
        }
    }
    else
    {
        SetPlayerVirtualWorld(playerid,virtualworld);
        SetPlayerInterior(playerid,interior);
        SetPlayerPos(playerid,Float:X,Float:Y,Float:Z);
        SetPlayerFacingAngle(playerid, Float:Angle);
        SetCameraBehindPlayer(playerid);
        new gtext[100];
        format(gtext,sizeof(gtext),"~g~WELCOME TO ~n~~w~%s",gametext);
        GameTextForPlayer(playerid,gtext,3000,3);
        new msg[256];
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
        format(msg, sizeof(msg), "%s has teleported to %s", pname, message);
        SendClientMessageToAll(msgcolor, msg);
    }
    return 1;
}
Thanks alot fiki and you have done a great job with that clan.inc

Btw. How come your able to use gametext and message as an argument to be used in format function without even defining them? Got a simple example?
__________________
I successfully reset password for my account and retrieved it after a few months.

I am back on work!



I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 10/05/2012, 04:25 PM   #38
fiki574
Gangsta
 
fiki574's Avatar
 
Join Date: Mar 2011
Location: Croatia
Posts: 822
Reputation: 151
Default Re: SetPlayerPosEx

Quote:
Originally Posted by Ballu Miaa View Post
Thanks alot fiki and you have done a great job with that clan.inc

Btw. How come your able to use gametext and message as an argument to be used in format function without even defining them? Got a simple example?
Thanks again!

Yea!
pawn Code:
SetPlayerPosEx(playerid,0.0,0.0,0.0,180.0,0,0,"~g~TEST TELEPORT","Test Teleport",-1,true);
__________________

If you need any help with anything related to SAMP and/or scripting/programming, feel free to PM me!
I am scripting/programming for money (very low prices, from $5 to $15 or more, price depends on complexity)
fiki574 is offline   Reply With Quote
Old 10/05/2012, 04:37 PM   #39
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,915
Reputation: 315
Default Re: SetPlayerPosEx

Quote:
Originally Posted by fiki574_CRO View Post
Thanks again!

Yea!
pawn Code:
SetPlayerPosEx(playerid,0.0,0.0,0.0,180.0,0,0,"~g~TEST TELEPORT","Test Teleport",-1,true);
Wow thats something nice. But in case i want ClientMessage to show for a SetPlayerPosEx and not gametext. Will be able to do it with one? If this works fine, Will add that to version 2. Thanks
__________________
I successfully reset password for my account and retrieved it after a few months.

I am back on work!



I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 10/05/2012, 04:41 PM   #40
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 18,432
Reputation: 2600
Default Re: SetPlayerPosEx

I'm not convinced that version will work - there is a mix of optional and required parameters that frankly take this a long way from it's original design.
Y_Less is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 08:12 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.