GTAMP.com

Grand Theft Auto Multiplayer
It is currently Mon Oct 22, 2018 5:10 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Mar 28, 2018 1:13 am 
Offline
Car Jacker

Joined: Sun Jan 29, 2012 6:56 pm
Posts: 32
Hi.
I didn´t find a solution here in the forum.

I detected a line of code in my script which causes problems:
Code:
IF(CHECK_CHAR_CURR_WEAPON (p2, WEAPON_14))
... do something here...
ENDIF

In game everything works well and I pretty need this check.
Only when p2 ( or any other player than p1 ) leaves the game it crashes every particpant instance.
Is there a known solution to handle this bug?

Or is it possible to set a flag, when a player actually left?

CHECK_CHARACTER_HEALTH(p2, 0))
doesn´t return FALSE after leaving at least :(
I guess the player dummy still remains somewhere in the memory, right?

Thanks for any tipps.


Top
 Profile  
 
PostPosted: Wed Mar 28, 2018 1:47 am 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1342
Location: GTAMP.com
There are some checks that return false when a player leaves but I can't remember which one right now, I must have recorded it somewhere.

There are some crashes related to the unused weapons like WEAPON_14, it may crash if a cop sees you fire it.

edit:

Found this in my testflight script http://gtamp.com/maps/testflight.7z
Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting
//do all this stuff to the current player then move to next player
//the CHECK_SCORE_GREATER is to detect if a player leaves the game
//leaving the game doesn't kill your character, so health check won't work
WHILE_EXEC ((player<playercount) AND (CHECK_SCORE_GREATER (p,0)))
 
Parsed in 0.013 seconds, using GeSHi 1.0.8.10

You would have to make sure the players always have at least $1. When a player leaves, they turn into a bot. Bots can't have money, so it always returns 0 for them.


Top
 Profile  
 
PostPosted: Wed Mar 28, 2018 2:12 am 
Offline
Hitman

Joined: Wed Dec 09, 2015 2:18 pm
Posts: 179
Another example (did not check it). But in theory it should work.

Code:
IF (NOT (HAS_CHARACTER_DIED (player2)))
    IF (CHECK_CHAR_CURR_WEAPON (player2, GRENADE))
        GIVE_WEAPON(player2, PISTOL)
    ENDIF
ENDIF

_________________
Map F-Industry-Live
MISI Library

Twitter https://twitter.com/TheNonameGames
VK https://vk.com/TheNonameGames
Telegram https://t.me/TheNonameGames


Top
 Profile  
 
PostPosted: Wed Mar 28, 2018 9:47 am 
Offline
Car Jacker

Joined: Sun Jan 29, 2012 6:56 pm
Posts: 32
Wrapping it into CHECK_SCORE_GREATER(0,p) works splendid. :)

As I first thought checking the players individually is the way to solve it
this now allowed me to tidy things up again a little.

I also had tried your approach, Logofero.
But I had no success.

I tested the following using an ONSCREEN_COUNTER for inc:
Code:
IF (HAS_CHARACTER_DIED (p2))
     ++inc
ENDIF


But inc was just raised every now and then, I guess that´s why it won´t work, also it seems logical in a way.

Thanks a lot! [respect]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group