SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 04/03/2018, 09:05 AM   #4531
KayJ
Gangsta
 
Join Date: Apr 2014
Posts: 704
Reputation: 64
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by GospodinX View Post
Do I need to hide textdraws onplayerdisconnect?
Yes, otherwise it will be bugged for player who joins after him.
__________________
SA:MP Wikipedia Profile

[Filterscript] Wallet + Robbery [Y_INI] [ZCMD] [BETA v0.1]
[Filterscript] Position - Save, Load & Delete [Y_INI] [ZCMD]
[Include] InfoText TextDraw
KayJ is offline   Reply With Quote
Old 16/03/2018, 07:57 AM   #4532
Aeny
Little Clucker
 
Join Date: Apr 2010
Posts: 2
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

First post after a long time of lurking.

It seems OnPlayerEnterVehicle doesn't get called when a player wants to enter a vehicle as driver and the doors are locked, but does get called when the doors are unlocked. OnPlayerEnterVehicle always gets called for passengers even when doors are locked.

Is this a known issue and is there a workaround for this? I know the animation not getting triggered is a known thing, but the callback not being called?
Aeny is offline   Reply With Quote
Old 16/03/2018, 12:04 PM   #4533
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 575
Reputation: 73
Default Re: Little coding questions - For general minor queries 5

Could be an error in your code. Do you mind sharing it?
ISmokezU is offline   Reply With Quote
Old 19/03/2018, 07:59 AM   #4534
Aeny
Little Clucker
 
Join Date: Apr 2010
Posts: 2
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by ISmokezU View Post
Could be an error in your code. Do you mind sharing it?
Used following code to reproduce the issue I'm having

Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new playerAnnouncement[128];
	format(playerAnnouncement, sizeof(playerAnnouncement), "playerid %d attempted to enter vehicleId %d (passenger %d)", playerid, vehicleid, ispassenger);
	SendClientMessage(playerid, 0xfffafa, playerAnnouncement);
	return 1;
}
The rest of the script is just bare.pwn as included within the server download.
Aeny is offline   Reply With Quote
Old 03/05/2018, 08:53 AM   #4535
Amads
Big Clucker
 
Amads's Avatar
 
Join Date: Feb 2012
Location: Poland
Posts: 197
Reputation: 40
Default Re: Little coding questions - For general minor queries 5

Am I retarded?
PHP Code:
new Float:fPos[3];
fPos = {2487.25122401.240211.4465}; 
Code:
A:\path\gm.pwn(2) : warning 213: tag mismatch
Amads is offline   Reply With Quote
Old 03/05/2018, 09:00 AM   #4536
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,953
Reputation: 1548
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by Amads View Post
Am I retarded?
PHP Code:
new Float:fPos[3];
fPos = {2487.25122401.240211.4465}; 
Code:
A:\path\gm.pwn(2) : warning 213: tag mismatch
fPos expects the rvalue to be tagged `Float:` currently it's an untagged array literal containing `Float:` tagged elements. `Float:{...}` should work.

However, I'd advise against that anyway, just use three variables. You're not gaining anything from using an array (in fact probably losing a tiny bit of processing by doing the array index arithmetic - but that's an over-optimisation anyway).

Just use `new Float:x, Float:y, Float:z;`
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 06/05/2018, 02:12 PM   #4537
Amads
Big Clucker
 
Amads's Avatar
 
Join Date: Feb 2012
Location: Poland
Posts: 197
Reputation: 40
Default Re: Little coding questions - For general minor queries 5

Code:
new strNames[500][4][MAX_PLAYER_NAME];
How resource heavy is an array like this one (if any)?
Amads is offline   Reply With Quote
Old 06/05/2018, 11:09 PM   #4538
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 3,739
Reputation: 646
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by Amads View Post
Code:
new strNames[500][4][MAX_PLAYER_NAME];
How resource heavy is an array like this one (if any)?
266000 Bytes = 259,765625 KiB - if global or static
or
10000 Bytes = 9,765625 KiB - if local, the remaining bytes will be allocated in stack

You can calculate the values by yourself or compile an empty file with this array and the -d3 flag (to get debug information)
Nero_3D is offline   Reply With Quote
Old 08/05/2018, 09:33 AM   #4539
Amads
Big Clucker
 
Amads's Avatar
 
Join Date: Feb 2012
Location: Poland
Posts: 197
Reputation: 40
Default Re: Little coding questions - For general minor queries 5

Alright, this is the last one from me, I swear.

A long time ago I've read somewhere (and it sticks with me to this day) than you should always assign timers in order to delete them with KillTimer later. Otherwise, they are not deleted properly and will linger in server's memory till the next server restart. Is that even true?
Amads is offline   Reply With Quote
Old 08/05/2018, 10:38 AM   #4540
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,953
Reputation: 1548
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by Amads View Post
Alright, this is the last one from me, I swear.

A long time ago I've read somewhere (and it sticks with me to this day) than you should always assign timers in order to delete them with KillTimer later. Otherwise, they are not deleted properly and will linger in server's memory till the next server restart. Is that even true?
Only repeating timers. Once a non repeating timer has ended, it should be cleaned up automatically.
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw 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 03:35 PM
Minor problem Desert Help Archive 4 17/03/2010 06:24 PM
Counting with mysql queries actiwe Help Archive 2 26/02/2010 02:36 PM
SQL queries using GROUP BY Dabombber Help Archive 2 05/10/2009 07:47 PM


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


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