SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/11/2017, 07:10 PM   #4461
Ritzy
High-roller
 
Ritzy's Avatar
 
Join Date: Jun 2014
Posts: 1,533
Reputation: 135
Default Re: Little coding questions - For general minor queries 5

Edit: Are you sure this function requires formatting?
__________________
Los Santos Has Fallen
Ritzy is offline   Reply With Quote
Old 20/11/2017, 09:11 PM   #4462
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,473
Reputation: 120
Default Re: Little coding questions - For general minor queries 5

If you use USI, use also y_va from YSI (obviously).
__________________
What matters isn't to going further, it's the way to get there
Dayrion is online now   Reply With Quote
Old 21/11/2017, 08:27 AM   #4463
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: Next to Oblivion (Kalcor's place)
Posts: 1,222
Reputation: 174
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by Ritzy View Post
Edit: Are you sure this function requires formatting?
Sorry, I just showed what I'm having problem with, using format along with that message causes errors, else the message works absolutely fine. Tweaking the function to what you said compiles it in both cases, but doesnt display any message in the non-formatted message (or both, I think!)

Quote:
Originally Posted by Dayrion View Post
If you use USI, use also y_va from YSI (obviously).
That's absolutely what I'm trying not to do here. I'm pretty sure there's an alternative.
__________________
Providing SA-MP, G-MOD, Minecraft, MTA and Web hosting @ https://www.prestigesteve.com.
Top notch quality experience and support!
Logic_ is offline   Reply With Quote
Old 21/11/2017, 04:14 PM   #4464
GaByM
Big Clucker
 
GaByM's Avatar
 
Join Date: Jan 2014
Location: Romania
Posts: 66
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

PHP Code:
#include <a_samp>
main()
{
    new 
k;
    if(
k)
        return 
1;
    else
    {
    }
    return 
1;

PHP Code:
D:\SERVER\gamemodes\a.pwn(10) : warning 225unreachable code 
Why?
GaByM is offline   Reply With Quote
Old 21/11/2017, 04:27 PM   #4465
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,724
Reputation: 1257
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by GaByM View Post
PHP Code:
#include <a_samp>
main()
{
    new 
k;
    if(
k)
        return 
1;
    else
    {
    }
    return 
1;

PHP Code:
D:\SERVER\gamemodes\a.pwn(10) : warning 225unreachable code 
Why?
That's actually a really good question!

I added `k = 1;` inside the `else` block and the warning went away so I assume, some kind of optimisation is removing the braces since they're empty and the `return 1;` at the end is falling into the `else` block maybe?

I'd love an answer to this too. I first dived into the asm output but this must be happening at the parsing level (AST building?)
[HLF]Southclaw is offline   Reply With Quote
Old 21/11/2017, 04:44 PM   #4466
AjaxM
Big Clucker
 
AjaxM's Avatar
 
Join Date: May 2016
Posts: 141
Reputation: 16
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by GaByM View Post
PHP Code:
#include <a_samp>
main()
{
    new 
k;
    if(
k)
        return 
1;
    else
    {
    }
    return 
1;

PHP Code:
D:\SERVER\gamemodes\a.pwn(10) : warning 225unreachable code 
Why?

Try using new bool:k;

It'll probably work by using the boolean tag.
__________________

CALL OF DUTY: GHOSTS - Website | Forum
AjaxM is offline   Reply With Quote
Old 25/11/2017, 12:05 AM   #4467
axellech
Big Clucker
 
Join Date: Mar 2016
Posts: 146
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

How to export an image to samp object?
axellech is offline   Reply With Quote
Old 01/12/2017, 05:49 PM   #4468
rfr
Big Clucker
 
Join Date: Nov 2017
Posts: 58
Reputation: 4
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by GaByM View Post
PHP Code:
#include <a_samp>
main()
{
    new 
k;
    if(
k)
        return 
1;
    else
    {
    }
    return 
1;

PHP Code:
D:\SERVER\gamemodes\a.pwn(10) : warning 225unreachable code 
Why?
PHP Code:
#include <a_samp> 
main() 

    new 
k
    if(
k
        return 
1
    else if (!
k
    { 
    } 
    return 
1

try this.
__________________
regards,
rfr is online now   Reply With Quote
Old 01/12/2017, 09:20 PM   #4469
Mister0
Huge Clucker
 
Mister0's Avatar
 
Join Date: Aug 2015
Posts: 208
Reputation: 18
Default Re: Little coding questions - For general minor queries 5

Hi, this error "Array index out of bounds" show when you acces an element past over you defined variable like new variable[20] and you acces 20 or 21 etc.
So I have this error

Code:
[20:58:23] [debug] AMX backtrace:
[20:58:23] [debug] #0 00068d9c in ?? (1) from rpggm.amx
[20:58:23] [debug] #1 001c3860 in public TimerSeconds () from rpggm.amx
[20:58:24] [debug] Run time error 4: "Array index out of bounds"
[20:58:24] [debug]  Accessing element at index 27 past array upper bound 25
so this error show me I have a variable [26] and I acces upper element, but I can sure you I have no variable with value [24] [25] or [26]
So I ask you what else can produce this error?
Mister0 is offline   Reply With Quote
Old 01/12/2017, 09:48 PM   #4470
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,724
Reputation: 1257
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by Mister0 View Post
Hi, this error "Array index out of bounds" show when you acces an element past over you defined variable like new variable[20] and you acces 20 or 21 etc.
So I have this error

Code:
[20:58:23] [debug] AMX backtrace:
[20:58:23] [debug] #0 00068d9c in ?? (1) from rpggm.amx
[20:58:23] [debug] #1 001c3860 in public TimerSeconds () from rpggm.amx
[20:58:24] [debug] Run time error 4: "Array index out of bounds"
[20:58:24] [debug]  Accessing element at index 27 past array upper bound 25
so this error show me I have a variable [26] and I acces upper element, but I can sure you I have no variable with value [24] [25] or [26]
So I ask you what else can produce this error?
Compile your script with -d3 to get some more useful information such as the exact line number that the error is occurring on.
[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 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 2 05/10/2009 08:47 PM


All times are GMT. The time now is 07:05 PM.


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