rob prob

Started by kokia, Aug 22, 2015, 04:38 AM

Previous topic - Next topic

kokia

hello guys i was unable to open my account in forum (somebody changepass now i got back it) and now i'm facing error, error is arthimetic op / between "null" and "integer"
code is
else if (  cmd == "rob" )
{
if ( status[player.ID].IsReg==true )
{
if ( status[player.ID].IsReg==true )
{
if ( player.IsSpawned )
{
if ( text )
{
local plr = FindPlayer( text );
if(plr)
{
if(plr.ID!=status[player.ID].rob)
{
if(GetPlayerDistance(player,plr) <= 3)
{
if(GetJob(plr)==2 )ClientMessage ( "Error - You cannot rob a trucker!", player,255,255,0);
else if(plr.ID==player.ID) ClientMessage( "Error - You cannot rob yourself.",player,255,255,0);
else
{
local cash=GetCash( plr ),cash1=GetCash( player ),temp=cash/10;
IncCash(player,temp.tointeger())
DecCash(plr,temp.tointeger())
ClientMessage ( player.Name +" has robbed $"+ temp +" from you.",plr,255,255,0);
ClientMessage ( "You've robbed $"+ temp +" from "+ plr.Name +".",player,255,255,0);
status[player.ID].rob=plr.ID;
status[player.ID].robbed=plr.ID;
status[plr.ID].robbedby=player.ID;
}
}
else ClientMessage ( "You need to be close to "+ plr.Name +" or should sit in his car as a passenger.",player,255,255,0);
}
else ClientMessage ( "You cannot rob that player again!", player,255,255,0);
}
else ClientMessage ( "That player is not online. ", player,255,255,0);
}
else ClientMessage ( "/"+cmd+" <Nick/ID>", player,255,255,0);
}
else ClientMessage ( "You're not spawned.", player,255,255,0);
}
else ClientMessage ( "You're not logged in.", player,255,255,0);
}
else ClientMessage ( "You're not registered.", player,255,255,0);
}
i have every function in my script like getplayerdistance incash getcash

Omar

#1
You have if ( status[player.ID].IsReg==true ) twice. Try changing the second one to the variable that checks if the player is logged instead (IsLogged for example).

kokia


FinchDon

that is not problem if u do /rob is it show anything?? like /rob ID if yes then error is...do u have rob robbed robbedby in class? if yes then.what is this?




local cash=GetCash( plr ),cash1=GetCash( player ),temp=cash/10;  ? u have GetCash?

Do You. have getjob?? well its vccnr command u can make your one easily



For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

kokia

i said i have every thing when i type /rob it shows nothing and error comes arthimetic op / between "null" and "integer"

Thijn

Your GetCash( player ) function returns 0 for some reason. You either have 0 cash, or you function is bugged.
0 / 10 = error.

Kratos_


I guess your GetCash( plr ) function returning either null or it do not have a return statement . So , it is assumed to be null . Otherwise , 0 is considered a valid value to be used with operator / except at denominator . Besides , this error is reproducible this way :-
local a = null;
a = a / 5;
In the middle of chaos , lies opportunity.

Thijn

Code by FinchDon removed.

Giving another system isn't the solution. He made something, it gets an error and asks for help.
You aren't going to suggest to buy a new car when someone has a tiny scratch now are you?



Me and Kratos_ have explained the error fine, and it's up to kokia to post his GetCash function so we can help him further.

FinchDon

ahm Thijn as what i say on my post this is not his command its vccnr leaked command of rob he just change but he forgot there is GetCash system that he doesn't have thats why i give him
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

Thijn

If he doesn't have a GetCash function he would've got the famous index does not exist error. Which he did not.
So please, if you have nothing useful to say, don't post.

Yes, the script he's using might come from a leaked script. But that doesn't mean we should just throw new commands at him saying that will fix it.
It might, but that's not how helping works. We help him with that he has.

FinchDon

k anyway as you say
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )