SA-MP Forums Archive
Keeps returning on "0" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Keeps returning on "0" (/showthread.php?tid=608325)



Keeps returning on "0" - lulo356 - 30.05.2016

I've created this command for a rob system, But the Request ID keeps returing on 0 can someone help me out?

PHP код:
#define MAX_REQUEST 20
enum Mreq
{
    
RName,
     
Reqid,
     
Requestedrob,
};
new 
Reqrobbery[MAX_REQUEST][Mreq];
stock RequestRobberId(ridplayerid)
{
    for(new 
rid 0rid MAX_REQUEST rid++)
    {
        if(
Reqrobbery[rid][requestedrob] == 0)
        {
            
Reqrobbery[rid][RName] = RPName(playerid);
            
Reqrobbery[rid][Reqid] = rid;
            
Reqrobbery[rid][Requestedrob] = 1;
            return 
1;
        }
    }
    return 
0;
}
command(requestrob,playeridparams[])
{
    new 
string[128], string2[128];
    
    for(new 
rid 0rid MAX_REQUEST rid++)
     {
        if(
robpermission[playerid] == 0)
        {
            if(
acceptedrob[playerid] == 1)
                return 
SendClientMessage(playeridWHITE"Your request is already approved not needed to request again");
            {
                
format(stringsizeof(string), "Your request has been sended to the online staff members");
                
SCM(playeridYELLOWstring);
                
format(string2sizeof(string2), "{FE2EC8}[Request] - {FFFFFF}%s has requested permission for a robbery [%d]"RPName(playerid), rid);
                
SendToMods(WHITEstring2);
                
robpermission[playerid] = 1;
            }
        }
    }
    return 
;
 } 



Re: Keeps returning on "0" - justjamie - 30.05.2016

The stock says "return 0" and you wonder why it returns 0

?


Re: Keeps returning on "0" - lulo356 - 30.05.2016

Quote:
Originally Posted by justjamie
Посмотреть сообщение
The stock says "return 0" and you wonder why it returns 0

?
Even when i removed that it keeps returning as 0


Re: Keeps returning on "0" - lulo356 - 31.05.2016

Bump.


Re: Keeps returning on "0" - Kaliber - 31.05.2016

Well...you do crazy stuff...

For example...in your command:

PHP код:
for(new rid 0rid MAX_REQUEST rid++) 
this loop...can u explain..this non sense?

and you never call
PHP код:
RequestRobberId 
and wonder...why this is never set?