Randome IsPlayerInRangeOfPoint problem
#1

Код:
new Float:atm[][0] =
{
	{599.59997559,-1244.80004883,17.89999962}
};

CMD:atm(playerid, params[])
{
    //if(IsPlayerInRangeOfPoint(playerid, 4.0, 599.59997559,-1244.80004883,17.89999962))
//{

	new rand = random(sizeof(atm));
	IsPlayerInRangeOfPoint(playerid, 4.0, atm[rand][0]); //is 3011
	ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
}
 else SendClientMessage(playerid, C_RED,"You need too be in the bank");//3015
 {
    return 1;//3017
}

Код:

C:\Users\Documents\Samp server files\SoldiersOf Anarchy Roleplay\gamemodes\soa0.4.pwn(3011) : warning 202: number of arguments does not match definition
C:\Users\Documents\Samp server files\SoldiersOf Anarchy Roleplay\gamemodes\soa0.4.pwn(3011) : warning 202: number of arguments does not match definition
C:\Users\Documents\Samp server files\SoldiersOf Anarchy Roleplay\gamemodes\soa0.4.pwn(3015) : error 010: invalid function or declaration
C:\Users\Documents\Samp server files\SoldiersOf Anarchy Roleplay\gamemodes\soa0.4.pwn(3017) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
If any one can tell me what i did wrong i would be appreciated
Reply
#2

I would help of you would give the lines of the script, i dont know whats wrong with it
Reply
#3

Oh yeah sorry will update in a sec
Reply
#4

You have an extra opening bracket above your return 1; remove that.
Reply
#5

Instead of rand, I would use a loop..To check all the positions of the ATMs.

pawn Код:
new Float:atm[][3] =
{
    {599.59997559,-1244.80004883,17.89999962}
};

CMD:atm(playerid, params[])
{
    if(IsNearAtm(playerid))
    {
        ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
    }
    else return SendClientMessage(playerid, C_RED,"You aren't near an atm!");//3015
    return 1;
}


stock IsNearAtm(playerid)
{
    new bool:returnval = false;
    for(new i=0; i < sizeof(atm); i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 4.0, atm[i][0], atm[i][1], atm[i][2])) returnval = true;
    }
    return returnval;
}
Reply
#6

Yeah i seen that after i posted but still get the errors
Reply
#7

Oh thanks it worked
Reply
#8

No problem...The reasons yours probably didn't work is...

pawn Код:
IsPlayerInRangeOfPoint(playerid, 4.0, atm[rand][0]); //is 3011
Takes 5 arguments...
pawn Код:
IsPlayerInRangeOfPoint(playerid, Float:radius, Float:X, Float:Y, Float:Z);
Even if it were to work, you had it as a random which is fine if you only have 1 atm..But if you have 2, 1/2 chance to work. 3, 1/3, 4 1/4, 5 1/5, etc.

Plus you should place it in an if statement

pawn Код:
Float:atm[][0]
Will give you an array error saying it's to small. The reason for that is because there's actually 3 slots in the second dimension that need to be used, X, Y, and Z.


Also when you commented out the other if, you forgot a bracket, and indented horribly :P
Reply
#9

i see thaks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)