Warning that i cannot fix. [Found out]
#1

Hello I've got this warning which i cant fix..

Код:
C:\Users\******\Desktop\!@#!@!#\pawno\include\ServerFunctions.inc(14) : warning 219: local variable "gravity" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
This is the function...

Код:
stock SetPlayerGravity(playerid,Float:gravity) 
{
for (new g = playerid; g <MAX_PLAYERS; g++)
    {
    	if(IsPlayerConnected(g))
        {
        playerid = SetGravity(Float:gravity);
        }
    }
}
Please help me with this warning!
Reply
#2

First off: WTF
In this function you loop through all players setting the global gravity variable repeatedly.
https://sampwiki.blast.hk/wiki/SetGravity
Then you try to use a non existent variable
playerid = SetGravity(Float:gravity);
SetGravity does not return a variable, and why would you put it in playerid in the first place?
Код:
stock SetPlayerGravity(playerid,Float:gravity) 
{
for (new g = playerid; g <MAX_PLAYERS; g++)
    {
    	if(IsPlayerConnected(g))
        {
        playerid = SetGravity(Float:gravity);
        }
    }
}
gravity is a samp variable i would assume, just call it something else.

I would suggest you get some sleep.
Reply
#3

No i was searching the forums for a function that would just set the players gravity. Not the whole servers gravity..
Reply
#4

That doesn't exist.
And why you thought that would do it baffles me.
The code doesn't make any logical sense.

You call the function SetGravity for each player, which sets the server gravity.
Then you assign the non return variable to playerid.

Please, go read tutorials on coding:

Are you a scripting beginner?
[url=https://sampwiki.blast.hk/wiki/Main_Page]https://sampwiki.blast.hk/wiki/Main_Page[/url
Reply
#5

No I'm not I've already read all this your telling me now stop flaming.
Reply
#6

Im not flaming, i am trying to get you to go learn the basics, in order to reduce the number of posts.

And from the piece of code you put up you should reread
http://forum.sa-mp.com/index.php?topic=2750.0
https://sampwiki.blast.hk/wiki/Main_Page
Reply
#7

Your bullshit insults me because your the one thats trying to make lots of posts and those posts your giving me don't match with gravity please dont reply anymore because you havn't read my post very well.
Quote:
Originally Posted by mansonh
In order to reduce the number of posts.
Reply
#8

Quote:
Originally Posted by ((Lorenc))
Your bullshit insults me because your the one thats trying to make lots of posts and those posts your giving me don't match with gravity please dont reply anymore because you havn't read my post very well.
Quote:
Originally Posted by mansonh
In order to reduce the number of posts.
Dude, You cannot set a players gravity individually without ******'s Server includes or something...

It's somehow done by Y-Less... I remember seeing it...

But the reality is that the default includes that are supplied with SAMP, are not able to individually set gravity.
Reply
#9

Quote:
Originally Posted by Sew_Sumi
Quote:
Originally Posted by ((Lorenc))
Your bullshit insults me because your the one thats trying to make lots of posts and those posts your giving me don't match with gravity please dont reply anymore because you havn't read my post very well.
Quote:
Originally Posted by mansonh
In order to reduce the number of posts.
Dude, You cannot set a players gravity individually without ******'s Server includes or something...

It's somehow done by Y-Less... I remember seeing it...

But the reality is that the default includes that are supplied with SAMP, are not able to individually set gravity.
Thanks so much that was a better explanation! Thx!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)