Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: kokia on Aug 22, 2015, 04:38 AM

Title: rob prob
Post by: kokia on Aug 22, 2015, 04:38 AM
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
Title: Re: rob prob
Post by: Omar on Aug 22, 2015, 06:15 AM
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).
Title: Re: rob prob
Post by: kokia on Aug 22, 2015, 07:08 AM
not works
Title: Re: rob prob
Post by: FinchDon on Aug 22, 2015, 10:16 AM
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



Title: Re: rob prob
Post by: kokia on Aug 22, 2015, 11:51 AM
i said i have every thing when i type /rob it shows nothing and error comes arthimetic op / between "null" and "integer"
Title: Re: rob prob
Post by: Thijn on Aug 22, 2015, 01:25 PM
Your GetCash( player ) function returns 0 for some reason. You either have 0 cash, or you function is bugged.
0 / 10 = error.
Title: Re: rob prob
Post by: Kratos_ on Aug 22, 2015, 02:02 PM

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;
Title: Re: rob prob
Post by: Thijn on Aug 22, 2015, 04:15 PM
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.
Title: Re: rob prob
Post by: FinchDon on Aug 23, 2015, 06:53 AM
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
Title: Re: rob prob
Post by: Thijn on Aug 23, 2015, 09:07 AM
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.
Title: Re: rob prob
Post by: FinchDon on Aug 23, 2015, 10:02 AM
k anyway as you say