Problem with gates.
#1

Hey.
So i was working on a car respray system. What i wanted to do is, After car enters a garage and the owner uses the command /respray, Gates of the garage gets closed, then while the gates are closed, the car gets resprayed, and after that the gates are opened again.

I wrote a script, but its not working... Gives me no errors, so i cant figure out what wrong. The gates are not closing, the color is not changed etc....

PHP код:
new GTimer[MAX_PLAYERS];
new 
CountG 10;
forward GaateTimer(playerid);
public 
GaateTimer(playerid)
{
    new 
GetPVarInt(playerid"PlayerCars");
     new 
GetPVarInt(playerid"CREVEH");
    
CountG--;
    if(
CountG == 9)
    {
    
MoveObject(TuneGate11813, -1068.821.51);//Gates closing
    
}
    if(
CountG == 5)
    {
    
ChangeVehicleColor(gCarInfo[i][cColor][0], CarInfo[i][cColor][1]);
    new 
query[128];
    
format(query,sizeof(query),"UPDATE "TABLE_CARS" SET colors = '%d, %d' WHERE id = '%d'"CarInfo[i][cColor][0], CarInfo[i][cColor][1], i);
    
mysql_query(query);
    }
    if(
CountG == 0)
    {
        
MoveObject(TuneGate11813, -1068.824.71);//Gates opening
        
KillTimer(GTimer[playerid]);
    }
    return 
1;
}
CMD:respray(playeridparams[])
{
    if(
PlayerLogged[playerid] == 0) return 1;
    new 
Float:x,Float:y,Float:z;
    if(
GetPlayerCar(playerid) == 0) return SendClientMessage(playeridCOLOR_GREYYouDoNotHaveAnyCar);
    new 
GetPVarInt(playerid"CREVEH");
    
GetVehiclePos(i,x,y,z);
    if(!
IsPlayerInRangeOfPoint(playerid,10.0,x,y,z)) return SendClientMessage(playeridCOLOR_GREYPlayerIsNotAtCar);
    if(!
IsPlayerInRangeOfPoint(playerid,10.0,1825.9583,-1082.3091,23.8466)) return SendClientMessage(playeridCOLOR_GREY"You need to be at the respray place");
    if(
IsPlayerInRangeOfPoint(playerid,10.0,1825.9583,-1082.3091,23.8466)){
    new 
color[2];
    if(
sscanf(params"iI(-1)"color[0], color[1]))
    {
        return 
SendClientMessage(playerid0xFF0000FF"Piemers: /Respray [color1] [color2]");
    }
    if(
color[1] == -1color[1] = color[0]; // If color2 was left out, set it the same as color 1
    
new szSuccess[44];
    
format(szSuccesssizeof(szSuccess), "Your cars color was changed to: {FFFFFF}%i un %i."color[0], color[1]);
    
GiveMoney(playerid, -30000);
    
SendClientMessage(playerid0x00FF00FFszSuccess);
    
CarInfo[i][cColor][0]= color[0];
    
CarInfo[i][cColor][1]= color[1];
    
KillTimer(GTimer[playerid]);
    
GTimer[playerid] = SetTimerEx("GaateTimer"10001"i"playerid);
    }
    
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)