Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] How can I do this?

 
  • 0 Vote(s) - 0 Average
Pawn How can I do this?
Boxi
Offline

Burgershot Member
Posts: 48
Threads: 23
Joined: Jan 2021
Reputation: 0
Location: Angel Pine
#1
2021-02-26, 09:14 PM
Hello everyone! A few days ago he asked how to modify the gravity, his answers helped me a lot. But now I have another problem, and it is that I need gravity to be X in a certain place. How do I do this? with VirtualWorld? I would MUCH appreciate your help. Greetings! :D
destiezk
Offline

Burgershot Member
Posts: 41
Threads: 1
Joined: Feb 2021
Reputation: 3
Location: Hungary
#2
2021-02-26, 09:45 PM (This post was last modified: 2021-02-26, 09:46 PM by destiezk.)
that's a bit more complicated. This is not the best way to make it at all, but I'm using this:
Code:
new PlayerDM[5][3][MapInfo] =
{
    {           //   X         Y                Z       A              Name
        {1306.9261,2195.0313,11.0234,212.9963,"Baseball"}, // home
        {1391.2493,2111.0488,11.0156,321.7007,"Baseball"},  // away
        {1367.4415,2196.2263,14.2495,177.9026,"Baseball"} // spec
    }
}
forward Timer();
public Timer()
{
new Float:zz;
GetPlayerPos(i, zz, zz, zz);
if(zz <  floatround(PlayerDM[Map][TEAM_HOME][z], floatround_ceil))
    SetGravity(0.0);
}

and make a timer for the public that plays every 250ms for example.
Virsenas
Offline

Burgershot Member
Posts: 47
Threads: 0
Joined: Feb 2021
Reputation: 6
#3
2021-02-26, 10:30 PM (This post was last modified: 2021-02-26, 10:52 PM by Virsenas.)
Code:
IsPlayerInArea(playerid, Float:MinX, Float:MaxX, Float:MinY, Float:MaxY)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
#pragma unused z
    if(x >= MinX && x <= MaxX && y >= MinY && y <= MaxY) { return 1; }
    return 0;
}

P.S. I think you can only set gravity only for all players. You can't set the gravity different for other players.
Boxi
Offline

Burgershot Member
Posts: 48
Threads: 23
Joined: Jan 2021
Reputation: 0
Location: Angel Pine
#4
2021-02-27, 12:46 PM
(2021-02-26, 09:45 PM)destiezk Wrote: that's a bit more complicated. This is not the best way to make it at all, but I'm using this:
Code:
new PlayerDM[5][3][MapInfo] =
{
{          //  X        Y                Z      A              Name
{1306.9261,2195.0313,11.0234,212.9963,"Baseball"}, // home
{1391.2493,2111.0488,11.0156,321.7007,"Baseball"},  // away
{1367.4415,2196.2263,14.2495,177.9026,"Baseball"} // spec
}
}
forward Timer();
public Timer()
{
new Float:zz;
GetPlayerPos(i, zz, zz, zz);
if(zz <  floatround(PlayerDM[Map][TEAM_HOME][z], floatround_ceil))
SetGravity(0.0);
}

and make a timer for the public that plays every 250ms for example.

Hello! First of all, thanks for answering C: could you explain to me what these coordinates are that you put here? is that I do not understand much. Thanks, again!

Code:
{1306.9261,2195.0313,11.0234,212.9963,"Baseball"}, // home
{1391.2493,2111.0488,11.0156,321.7007,"Baseball"},  // away
{1367.4415,2196.2263,14.2495,177.9026,"Baseball"} // spec
Boxi
Offline

Burgershot Member
Posts: 48
Threads: 23
Joined: Jan 2021
Reputation: 0
Location: Angel Pine
#5
2021-02-27, 12:47 PM
(2021-02-26, 10:30 PM)Virsenas Wrote:
Code:
IsPlayerInArea(playerid, Float:MinX, Float:MaxX, Float:MinY, Float:MaxY)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
#pragma unused z
    if(x >= MinX && x <= MaxX && y >= MinY && y <= MaxY) { return 1; }
    return 0;
}

P.S. I think you can only set gravity only for all players. You can't set the gravity different for other players.

Isn't it possible to do that?
Virsenas
Offline

Burgershot Member
Posts: 47
Threads: 0
Joined: Feb 2021
Reputation: 6
#6
2021-02-27, 01:14 PM
(2021-02-27, 12:47 PM)Boxi Wrote:
(2021-02-26, 10:30 PM)Virsenas Wrote:
Code:
IsPlayerInArea(playerid, Float:MinX, Float:MaxX, Float:MinY, Float:MaxY)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
#pragma unused z
    if(x >= MinX && x <= MaxX && y >= MinY && y <= MaxY) { return 1; }
    return 0;
}

P.S. I think you can only set gravity only for all players. You can't set the gravity different for other players.

Isn't it possible to do that?

https://open.mp/docs/scripting/functions/SetGravity

Quote:Description

Set the gravity for all players.
Kwarde
Offline

Burgershot Member
Posts: 99
Threads: 2
Joined: Sep 2020
Reputation: 8
Location: The Netherlands
#7
2021-02-27, 02:13 PM
In combination with Pawn.RakNet: https://github.com/Romz24/samp-gravity
destiezk
Offline

Burgershot Member
Posts: 41
Threads: 1
Joined: Feb 2021
Reputation: 3
Location: Hungary
#8
2021-02-28, 10:45 AM (This post was last modified: 2021-02-28, 10:48 AM by destiezk.)
(2021-02-27, 12:46 PM)Boxi Wrote:
(2021-02-26, 09:45 PM)destiezk Wrote: that's a bit more complicated. This is not the best way to make it at all, but I'm using this:
Code:
new PlayerDM[5][3][MapInfo] =
{
{          //  X        Y                Z      A              Name
{1306.9261,2195.0313,11.0234,212.9963,"Baseball"}, // home
{1391.2493,2111.0488,11.0156,321.7007,"Baseball"},  // away
{1367.4415,2196.2263,14.2495,177.9026,"Baseball"} // spec
}
}
forward Timer();
public Timer()
{
new Float:zz;
GetPlayerPos(i, zz, zz, zz);
if(zz <  floatround(PlayerDM[Map][TEAM_HOME][z], floatround_ceil))
SetGravity(0.0);
}

and make a timer for the public that plays every 250ms for example.

Hello! First of all, thanks for answering C: could you explain to me what these coordinates are that you put here? is that I do not understand much. Thanks, again!

Code:
{1306.9261,2195.0313,11.0234,212.9963,"Baseball"}, // home
{1391.2493,2111.0488,11.0156,321.7007,"Baseball"},  // away
{1367.4415,2196.2263,14.2495,177.9026,"Baseball"} // spec

Well it's what I use in my code.. I have three teams (Home, Away, Spectator) and it's their spawn position.
Otherwise, SetGravity() function is used for all players, you can use Pawn.Raknet and this https://github.com/Romz24/samp-gravity so you can actually make it.
DandoRYx
Offline

Burgershot Member
Posts: 20
Threads: 0
Joined: Feb 2021
Reputation: 2
Location: Slovakia
#9
2021-02-28, 12:11 PM (This post was last modified: 2021-02-28, 12:12 PM by DandoRYx.)
You can try to use plugin: https://github.com/IllidanS4/YSF

Code:
native SetPlayerGravity(playerid, Float:gravity);
native Float:GetPlayerGravity(playerid);

It has more useful functions, check it out.
Boxi
Offline

Burgershot Member
Posts: 48
Threads: 23
Joined: Jan 2021
Reputation: 0
Location: Angel Pine
#10
2021-02-28, 01:58 PM
I will use the Pawn.Raknet thank you all very much for your answers, I appreciate it very much
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#11
2021-03-07, 01:15 PM
I really suggest you use YSF for this, not pawn.raknet. The former is nice functions you can use easily, the latter is a very low-level hack.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode