Command Doesn't do anything
#1

The command only prints (Done?) which is under
PHP код:
CMD:buycar(playeridparams[])
{
    new 
bool:in_range false;
    new 
bool:notIn false;
    new 
bool:noMoney false;
    new 
bool:AlreadyHas false;
    new 
bool:NotForSale false;
    for(new 
1<= MAX_VEHICLESa++)
    {
        new 
Float:vxFloat:vyFloat:vz;
        
GetVehiclePos(avxvyvz);
        if(
IsPlayerInRangeOfPoint(playerid3.0vxvyvz))
        {
            if(
CarInDb[a] == false) { notIn true; }
        }
    }
    if(
notIn == true) return SendClientMessage(playeridCOLOR_RED"This is a server-car!");
    for(new 
0!= CarsLoad;i++)
    {
        if(
IsPlayerInRangeOfPoint(playerid3.0CarInfo[i][CarX], CarInfo[i][CarY], CarInfo[i][CarY]))
        {
            if(
GetPlayerMoney(playerid) < CarInfo[i][CarPrice])
            {
                if(
PlayerInfo[playerid][pHasCar] > 2)
                {
                    if(
CarInfo[i][cSale] == 0)
                    {
                        if(
strcmp(CarInfo[i][owner], "None"))
                        {
                            new 
UMoney[128];
                            new 
Smoney[128];
                            new 
money format(Smoneysizeof(Smoney), "SELECT pMoney FROM users WHERE pName='%s'",CarInfo[i][owner]);
                            
mysql_query(1Smoney);
                            
format(UMoneysizeof(UMoney), "UPDATE users SET pMoney='%i' WHERE username='%s'",money+CarInfo[i][CarPrice], CarInfo[i][owner]);
                            
mysql_query(1UMoney);
                        }
                        new 
query[200];
                        
format(querysizeof(query), "UPDATE cars SET owner='%s', owned='1', cSale='0' WHERE id='%i'",PlayerName(playerid), CarInfo[i][CarID]);
                        
mysql_query(1query);
                        
PlayerInfo[playerid][pHasCar]++;
                        
GivePlayerMoney(playerid, -CarInfo[i][CarPrice]);
                    }
                    else { 
NotForSale true; }
                 } else { 
AlreadyHas true; }
            } else { 
noMoney true; }
        } else { 
notIn true; }
    }
    if(
in_range == true) return SendClientMessage(playeridCOLOR_RED"You aren't near any for-sale car!");
    if(
noMoney == true) return SendClientMessage(playeridCOLOR_RED"You don't have enough money!");
    if(
AlreadyHas == true) return SendClientMessage(playeridCOLOR_RED"You already have two cars!");
    if(
NotForSale == true) return SendClientMessage(playeridCOLOR_RED"This vehicle isn't for sale!");
    print(
"Done?");
    return 
1;

PHP код:
CarsLoad clamp(cache_get_row_count(), 0sizeof CarInfo 1); 
I'm making it on this way to prevent messages spamming in loops but it doesn't do anything :/
Reply


Messages In This Thread
Command Doesn't do anything - by nezo2001 - 29.08.2015, 18:04
Re: Command Doesn't do anything - by nezo2001 - 29.08.2015, 18:21
Re: Command Doesn't do anything - by nezo2001 - 29.08.2015, 20:13
Re: Command Doesn't do anything - by Trollerz - 29.08.2015, 20:15
Re: Command Doesn't do anything - by nezo2001 - 29.08.2015, 20:17
Re: Command Doesn't do anything - by Ahmad45123 - 29.08.2015, 20:18
Re: Command Doesn't do anything - by nezo2001 - 29.08.2015, 20:21
Re: Command Doesn't do anything - by Ahmad45123 - 29.08.2015, 20:24
Re: Command Doesn't do anything - by nezo2001 - 29.08.2015, 20:26
Re: Command Doesn't do anything - by nezo2001 - 29.08.2015, 21:38

Forum Jump:


Users browsing this thread: 1 Guest(s)