Raised This Month: $ Target: $400
 0% 

[HELP] With setting gravity on user.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 03-03-2014 , 15:09   [HELP] With setting gravity on user.
Reply With Quote #1

Hi, there, i want to ask you why doesn't this work. I've a VIPmenu where you can choise gravity, but when I make it like this:
set_user_gravity(id, 300.0)
It starts flying in air and it cant fall on the ground. I'm wondering, how can i make it like on deathrun server, or like when you type sv_gravity 300 in console and get low gravity. I'll give you the .sma to take a look on it! It's about the 3rd case, when i want to set the user 300 gravity by choosing option 3 on the menu.

And it looks like this (DEMO) : http://dox.bg/files/dw?a=787b241ce8
PHP Code:
public VipCTMenu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
            
set_user_health(idget_user_health(id) + 30);
            
set_user_armor(idget_user_armor(id) + 30);
            
VipUsed[id] = true;
            
            
client_printc(id"%s Ti izbra !g30 Hp!n + !g30 Armor!n"PREFIX);
        }
        case 
2:
        {
            
give_item(id,"weapon_hegrenade");
            
give_item(id,"weapon_flashbang");
            
give_item(id,"weapon_flashbang");
            
give_item(id,"weapon_smokegrenade");
            
            
VipUsed[id] = true;
            
            
client_printc(id"%s Ti izbra !gVsichki Granati"PREFIX);
        }
        
         
        case 
3
        { 
            
       
set_user_gravity(id 300.0);
  
            
VipUsed[id] = true;

            
client_printc(id"%s Ti izbra !gGravity"PREFIX); 
        } 
            
              case 
4
        {
    
            
set_user_maxspeed(idfast_speed);
            
VipUsed[id] = true;
            
HasSpeed true;
            
            
client_printc(id"%s Ti izbra !gSpeed!n"PREFIX);
   } 
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
VipTMenu(id)
{
    new 
menu menu_create("\yVIP Menu \r(TR):^n""VipTMenu_handler");

    
menu_additem(menu"\w30 HP + 30 Amrmor""1"0);
    
menu_additem(menu"\wAll Grenades""2"0);
    
menu_additem(menu"\wGravity""3"0);
    
menu_additem(menu"\wSpeed""4"0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
VipTMenu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
            
set_user_health(idget_user_health(id) + 30);
            
set_user_armor(idget_user_armor(id) + 30);
            
VipUsed[id] = true;
            
            
client_printc(id"%s Ti izbra !g30 Hp!n + !g30 Armor!n"PREFIX);
        }
        case 
2:
        {
         
give_item(id,"weapon_hegrenade");
         
give_item(id,"weapon_flashbang");
    
give_item(id,"weapon_flashbang");
         
give_item(id,"weapon_smokegrenade");
            
            
VipUsed[id] = true;
            
            
client_printc(id"%s Ti izbra !gVsichki Granati"PREFIX);
        }
        
         
        case 
3
        { 
               
            
set_user_gravity(id300);
  
            
VipUsed[id] = true

            
client_printc(id"%s Ti izbra !gGravity"PREFIX); 
        } 
            
              case 
4
        {
    
            
set_user_maxspeed(idfast_speed);
            
VipUsed[id] = true;
            
HasSpeed true;
            
            
client_printc(id"%s Ti izbra !gSpeed!n"PREFIX);
   } 
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

Sorry for my english!

Last edited by Flick3rR; 03-03-2014 at 15:17.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
minato
Senior Member
Join Date: May 2010
Location: Rosario
Old 03-03-2014 , 15:20   Re: [HELP] With setting gravity on user.
Reply With Quote #2

PHP Code:
set_user_gravity(index0.3
__________________
minato is offline
Send a message via MSN to minato
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-03-2014 , 15:23   Re: [HELP] With setting gravity on user.
Reply With Quote #3

set_user_gravity works differently than sv_gravity. Setting it to 1 will make the user's gravity the same as the server. Setting it less than 1 makes it less than the server and greater than 1 makes it higher than the server
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 03-03-2014 , 16:06   Re: [HELP] With setting gravity on user.
Reply With Quote #4

That's what is happening - http://prikachi.com/images.php?images/129/7123129H.jpg
Errors, again and again. I don't know what to do, i tried to set it on 0.3, 0.64, and many other numbers, but the same thing happens in the server.
PHP Code:
set_user_gravity(id0.63)
set_user_gravity(id0.33)
set_user_gravity(id0.2)
set_user_gravity(id0.80
They all don't work. Plese, help!
Flick3rR is offline
Send a message via Skype™ to Flick3rR
mapper07
Member
Join Date: Oct 2012
Location: NY
Old 03-03-2014 , 17:14   Re: [HELP] With setting gravity on user.
Reply With Quote #5

change index to id
mapper07 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 03-04-2014 , 03:39   Re: [HELP] With setting gravity on user.
Reply With Quote #6

Look to the upper post, with index or id, it doesn't work. I'm flyung up and down in the server again and this is weird. Maybe I need to add something else in the .sma to fix it?
Flick3rR is offline
Send a message via Skype™ to Flick3rR
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 03-04-2014 , 03:47   Re: [HELP] With setting gravity on user.
Reply With Quote #7

Code:
const Float:fPlayerGravity = 300.0 set_user_gravity(id, fPlayerGravity / 800)
__________________

Last edited by georgik57; 03-04-2014 at 04:37.
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 03-04-2014 , 04:06   Re: [HELP] With setting gravity on user.
Reply With Quote #8

it should be vice-versa
cause 300 means that player ir lighter than normally (800), but with your code it would be heavier, so it must be then 300.0 / 800.0
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 03-04-2014 , 04:37   Re: [HELP] With setting gravity on user.
Reply With Quote #9

Quote:
Originally Posted by NiHiLaNTh View Post
it should be vice-versa
cause 300 means that player ir lighter than normally (800), but with your code it would be heavier, so it must be then 300.0 / 800.0
Corrected.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 03-04-2014 , 15:58   Re: [HELP] With setting gravity on user.
Reply With Quote #10

Thank you, Georgik57!!!! This worked, thank you so much!
Now i want to ask, why when I set some speed to user, it's like the maximum fast, and the number of the speed doesnt matter, it's everytime that fast. I want to ask, how am I supposed to set_user speed, just little over the normal. Like if the normal is 250, i want to set the user speed 300. Perhaps it's again something with new float, but i'll be so grateful if someone tell me what to do.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Reply



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

Forum Jump


All times are GMT -4. The time now is 05:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode