hello guys plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz help me there is a problem
reg function error : arith op + between "null" and "integer" plzzzzzzzzzzzzzzz help help help
code :
function Register( player, password )
{
try{
local pass = SHA256(password);
QuerySQL( db, "INSERT INTO Account ( Name, UID, Level, Pass, Cash, Kills, Deaths ) VALUES ( '" + player.Name.tolower() + "', '" + player.UniqueID + "', '1', '" + pass + "', '0', '0', '0' )" );
status[ player.ID ].IsLogged = true;
status[ player.ID ].IsReg = true;
local q = QuerySQL(db,"SELECT Cash FROM Accounts WHERE Name='"+player.Name+"'")
status[player.ID].Cash=GetSQLColumnData(q,0)
status[player.ID].Kills=GetSQLColumnData(q,1)
status[player.ID].Deaths=GetSQLColumnData(q,2)
IncCash(player,5000)
ServerMessage( "You've successfully registered with the password " + password, player );
}
catch(e) print( "Reg Function Error: " + e );
}
error on inccash i give :
function IncCash( player, amount )
{
local cash = status[ player.ID ].Cash;
local add = cash + amount;
status[ player.ID ].Cash = add;
player.Cash = add;
}
Post the screenshots. Of errors.
use this:-
function IncCash( player, amount )
{
local cash = status[ player.ID ].Cash;
local add = cash + amount.tointeger();
status[ player.ID ].Cash = add;
player.Cash = add;
}
If it doesn't works, remove the try-catch blocks and tell us the error line.
doesnt works
removed try catch
prob is continueing
line 305 : local add = cash + amount.tointeger();
line 1335 : IncCash(player,5000)
line 422 : else Register(player,text)
Try using this:
function Register( player, password )
{
try{
local pass = SHA256(password);
QuerySQL( db, "INSERT INTO Account ( Name, UID, Level, Pass, Cash, Kills, Deaths ) VALUES ( '" + player.Name.tolower() + "', '" + player.UniqueID + "', '1', '" + pass + "', '0', '0', '0' )" );
status[ player.ID ].IsLogged = true;
status[ player.ID ].IsReg = true;
local q = QuerySQL(db,"SELECT Cash, Kills, Deaths FROM Accounts WHERE Name='"+player.Name.tolower()+"'");
if ( GetSQLColumnData(q, 0 ) )
{
status[player.ID].Cash=GetSQLColumnData(q,0);
status[player.ID].Kills=GetSQLColumnData(q,1);
status[player.ID].Deaths=GetSQLColumnData(q,2);
}
FreeSQLQuery( q );
IncCash( player,5000 );
ServerMessage( "You've successfully registered with the password " + password, player );
}
catch(e) print( "Reg Function Error: " + e );
}
error is still coming
@Mashreq help plaese
Try using this function for Increasing the player's cash
function IncCash( player, amount )
{
local cash = status[ player.ID ].Cash;
local add = cash.tointeger() + amount.tointeger();
status[ player.ID ].Cash = add;
player.Cash = add;
}
pooooooooooooop, hello, poop, function poop, give poop and help, help, help, poop cash poop error poop... That's all I see there.
But my suggestion:
print(null + 3);
Quite obvious isn't it?