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
Ritzy2K
High-roller
 
Ritzy2K's Avatar
 
Join Date: Jun 2014
Location: India
Posts: 1,680
Reputation: 168
Default Re: Little coding questions - For general minor queries 5

Edit: Are you sure this function requires formatting?
__________________
Ritzy2K 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,926
Reputation: 256
Default Re: Little coding questions - For general minor queries 5

If you use USI, use also y_va from YSI (obviously).
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 21/11/2017, 08:27 AM   #4463
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: 666
Posts: 1,490
Reputation: 273
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.
__________________
-
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: 112
Reputation: 10
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,965
Reputation: 1550
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?)
__________________
Tools:

Plugins:

Links:

[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: 148
Reputation: 25
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 | IP: Coming soon
AjaxM is offline   Reply With Quote
Old 25/11/2017, 12:05 AM   #4467
axellech
Big Clucker
 
Join Date: Mar 2016
Posts: 195
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
Banned
 
Join Date: Nov 2017
Posts: 278
Reputation: 43
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.
rfr is offline   Reply With Quote
Old 01/12/2017, 09:20 PM   #4469
Mister0
Huge Clucker
 
Mister0's Avatar
 
Join Date: Aug 2015
Posts: 216
Reputation: 19
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 online now   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,965
Reputation: 1550
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.
__________________
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 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 10:38 AM.


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