SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/06/2020, 06:33 AM   #1
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default Global Chat ingame error

So it seems I keep having the same problems over and over in my Gamemode...
I have Sandboxie, so I am able to test if my functions are working, and majority are...
Unfortunately I keep having this specific error, I am wondering if its not actually linked to what I am doing, but more deeper issue, anyway if there is an issue in my code, can someone please help me find it.

- Player 1 Joins Server (ID 0)
- Player 2 Joins Server (ID 1)

Player 1(ID 0) Sends Message in /globalchat
-Player 1(ID 0) Can see the Message.
-Player 2(ID 1) Can see the Message.

Player 2(ID 1) Sends Message in /globalchat
-Player 1(ID 0) Can see the Message.
-Player 2(ID 1) Can NOT see the Message.

I Have had problems in the past, where the experience of ID 0, is not the same as id 1+

FIXED!
Code:
 foreach(Player, i) if(Player[i][ToggledGlobalChat] == 0) SendClientMessage(i, -1, string);
__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs

Last edited by SkyFlare; 09/06/2020 at 08:03 AM.
SkyFlare is offline   Reply With Quote
Old 09/06/2020, 08:29 AM   #2
Fairuz
Huge Clucker
 
Fairuz's Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 468
Reputation: 89
Default Re: Global Chat ingame error

You are using the deprecated method of foreach, just a heads up..
__________________
Los Santos based Cops and Robbers with many features.
178.128.82.211:7777
Fairuz is offline   Reply With Quote
Old 09/06/2020, 09:43 AM   #3
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default Re: Global Chat ingame error

Quote:
Originally Posted by Fairuz View Post
You are using the deprecated method of foreach, just a heads up..
How is it deprecated? can you show me a better method please?
__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare is offline   Reply With Quote
Old 09/06/2020, 11:40 AM   #4
Adamoneoone
Huge Clucker
 
Join Date: Sep 2014
Posts: 485
Reputation: 37
Default Re: Global Chat ingame error

Code:
foreach(Player, i)
is the old way to use foreach.
Code:
foreach(new i:Player)
is how you'd want to do it.
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!
Adamoneoone is offline   Reply With Quote
Old 09/06/2020, 01:31 PM   #5
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default Re: Global Chat ingame error

Quote:
Originally Posted by Adamoneoone View Post
Code:
foreach(Player, i)
is the old way to use foreach.
Code:
foreach(new i:Player)
is how you'd want to do it.
What does that do? apart from the obvious making a new integer value named i? what benefits does it reap?
__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare 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
Global Chat Help? Tass007 Scripting Help 9 07/05/2016 02:47 PM
[HELP]Global Chat KimGuan Scripting Help 7 14/11/2013 06:49 AM
InGame Chat log. kepa333 Scripting Help 8 13/06/2013 12:14 PM
How to make chat and disable the Starting global chat slymatt Help Archive 1 20/07/2011 02:10 AM
Ingame Chat? SA_Warz Help Archive 1 26/04/2010 10:42 PM


All times are GMT. The time now is 04:50 AM.


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