SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/07/2010, 02:46 AM   #1021
michael2572
Big Clucker
 
Join Date: Jan 2007
Posts: 49
Reputation: 20
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by Vince View Post
I have a slight problem here.

pawn Code:
SetPlayerWantedLevel(playerid, floatround(level/2, floatround_ceil));

When I input 'level' as being 5, it rounds to 2 and not to 3 which is supposed to be.
Or am I missing something here?
Int/Int = Int

So,
5/2 = 2
Ceiling of 2 = 2.

You need to perform the division using floats, try this:
SetPlayerWantedLevel(playerid, floatround(floatval(level)/2.0, floatround_ceil));

(Make sure floatval's the right function, I can't remember the exact name but I'm pretty sure that's the one that returns a float from an int)
__________________
super fun derby since 2009 - cnbderby.net:7777

Last edited by michael2572; 17/07/2010 at 06:33 PM.
michael2572 is offline   Reply With Quote
Old 19/07/2010, 05:40 PM   #1022
zeli
Big Clucker
 
zeli's Avatar
 
Join Date: Nov 2008
Posts: 53
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

I have a bug. I put AllowInteriorWeapons(0); under OnGameModeInit, and it does not disallow the interior weapons.
I dont know why this bug happens, i unloaded all the filterscripts, but it doesnt work. (in my GM this function can be found once, so there arent multiples)
Any ideas?
__________________
"See the champions, take the field now, you #define us, make us feel proud" - World Cup anthem
Signup for League of Legends
zeli is offline   Reply With Quote
Old 19/07/2010, 06:14 PM   #1023
Kar
Banned
 
Join Date: May 2010
Location: Black Asylum
Posts: 2,940
Reputation: 538
Default Re: Little coding questions - For general minor queries 5

AllowInteriorWeapons(true);


true / 1 = yes

0/false = no

and what are interior weapons anyways lol
Kar is offline   Reply With Quote
Old 19/07/2010, 08:44 PM   #1024
Finn
High-roller
 
Join Date: Jan 2008
Posts: 1,464
Reputation: 382
Default Re: Little coding questions - For general minor queries 5

If I remember right AllowInteriorWeapons was removed since the first versions of 0.3.

Edit: SetPlayerArmedWeapon will do the trick.
Finn is offline   Reply With Quote
Old 21/07/2010, 05:41 AM   #1025
PotH3Ad
Huge Clucker
 
Join Date: Jul 2008
Location: Westside - CA
Posts: 285
Reputation: 5
Default Re: Little coding questions - For general minor queries 5

How can I convert a hex color to the color code textdraw's use? I searched around, still not really sure on how to do this. Thanks ahead of time .

EDIT: Fail, didn't need to convert :P.

Last edited by PotH3Ad; 21/07/2010 at 05:54 AM.
PotH3Ad is offline   Reply With Quote
Old 21/07/2010, 10:48 AM   #1026
MrDeath537
High-roller
 
Join Date: Nov 2009
Location: Argentina
Posts: 1,959
Reputation: 29
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by PotH3Ad View Post
How can I convert a hex color to the color code textdraw's use? I searched around, still not really sure on how to do this. Thanks ahead of time .

EDIT: Fail, didn't need to convert :P.
xD, you can use "%x" to hex. Example:
format(string, sizeof(string), "%x", 255);
it's: FF
MrDeath537 is offline   Reply With Quote
Old 21/07/2010, 01:31 PM   #1027
zeli
Big Clucker
 
zeli's Avatar
 
Join Date: Nov 2008
Posts: 53
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by Finn View Post
If I remember right AllowInteriorWeapons was removed since the first versions of 0.3.

Edit: SetPlayerArmedWeapon will do the trick.
I'll try it, thanks!

edit: It works, thank you.
__________________
"See the champions, take the field now, you #define us, make us feel proud" - World Cup anthem
Signup for League of Legends

Last edited by zeli; 21/07/2010 at 09:22 PM.
zeli is offline   Reply With Quote
Old 23/07/2010, 05:41 PM   #1028
Roroboy
Little Clucker
 
Join Date: May 2008
Posts: 29
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

Ok, I have a problem. I created a pickup icon to an ammunation interior, but when I enter the pickup, I spawn in the air. Anyone know what the problem is?

Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == BMercEntrance)
        {
                SetPlayerPos(playerid, -1819.4108,-149.4685,9.3984);
Roroboy is offline   Reply With Quote
Old 23/07/2010, 05:57 PM   #1029
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,200
Reputation: 22
Default Re: Little coding questions - For general minor queries 5

You also need to set the players interior

http://wiki.sa-mp.com/wiki/SetPlayerInterior
http://wiki.sa-mp.com/wiki/InteriorIDs
dice7 is offline   Reply With Quote
Old 23/07/2010, 06:07 PM   #1030
Roroboy
Little Clucker
 
Join Date: May 2008
Posts: 29
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == BMercEntrance)
        {
				SetPlayerInterior(playerid, 7);
				SetPlayerPos(playerid, 314.820984,-141.431992,999.661987);
Still not working, even with the link you gave me I updated it.
Roroboy 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make a soldier aotumaticly be general when the general dies ? AlbanianGuy Scripting Help 35 13/05/2012 04:35 PM
Minor problem Desert Help Archive 4 17/03/2010 07:24 PM
Counting with mysql queries actiwe Help Archive 2 26/02/2010 03:36 PM
SQL queries using GROUP BY Dabombber Help Archive 1 05/10/2009 08:47 PM


All times are GMT. The time now is 11:33 PM.


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