Engine system not working for groups
#1

I made a engine system for my server i got it working but when you try to start group cars it does work Its says you don't own this vehicle could somebody please help me.

PHP код:
command(engineplayeridparams[]) 

    new 
Float:hp
    
GetVehicleHealth(GetPlayerVehicleID(playerid), hp); 
    if(
hp 400
    { 
    if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2
    { 
        if(
IsAnOwnedCar(GetPlayerVehicleID(playerid))) 
        { 
            new 
vehicleid GetPlayerVehicleID(playerid); 
            new 
string[256]; 
            new 
enginelightsalarmdoorsbonnetbootobjective
            new 
PlayerVehicle GetVehicleFileID(GetPlayerVehicleID(playerid)); 
            if(
Player[playerid][CarLinkID] == vehicleid || Player[playerid][Car2LinkID] == vehicleid || Player[playerid][Car3LinkID] == vehicleid || Vehicles[PlayerVehicle][CarGroup] == Player[playerid][Group]) 
            { 
                
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective); 
                if(
Vehicles[vehicleid][Engine] == 0
                { 
                    
format(stringsizeof(string), "*%s reaches for their key, and places it in the ignition before turning it."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
Player[playerid][CarEngineStatus] = 1
                    
SetTimer("EngineOn"3000false); 
                } 
                else if(
Vehicles[vehicleid][Engine] == 1
                { 
                    
format(stringsizeof(string), "*%s reaches for their key, and removes it from the ignition."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
SetVehicleParamsEx(vehicleid0lightsalarmdoorsbonnetbootobjective); 
                    
Vehicles[vehicleid][Engine] = 0
                } 
            } 
            else 
SendClientMessage(playeridGREY"You do not own this vehicle."); 
     } 
        else 
SendClientMessage(playeridGREY"You do not own this vehicle."); 
    } 
    else 
SendClientMessage(playeridGREY"You are not in a vehicle."); 
    } 
    else 
SendClientMessage(playeridGREY"This vehicle is broken."); 
    return 
1

This is the command to lock a vehicle to a group so that only group members can use it
PHP код:
command(setcargroupplayeridparams[]) 

    new 
idstring[128]; 
    if(
sscanf(params"d"id)) 
    { 
        if(
Player[playerid][AdminLevel] >= 1
        { 
            
SendClientMessage(playeridWHITE"SYNTAX: /setcargroup [group ID]"); 
        } 
    } 
    else 
    { 
        if(
Player[playerid][AdminLevel] >= 4
        { 
            if(
IsPlayerInAnyVehicle(playerid)) 
            { 
                if(
id >= && id MAX_GROUPS
                { 
                    if(
GetVehicleFileID(GetPlayerVehicleID(playerid))  == 0
                    { 
                        
SendClientMessage(playeridWHITE"That doesn't seem to be a saved vehicle."); 
                    } 
                    else 
                    { 
                        if(
id == 0
                        { 
                            
SendClientMessage(playeridWHITE"You have unlocked this vehicle."); 
                            
Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup] = 0
                        } 
                        else 
                        { 
                            
Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup] = id
                            
format(stringsizeof(string), "You have locked this vehicle to Group %s."Groups[id][GroupName]); 
                            
SendClientMessage(playeridWHITEstring); 
                            
SaveExistingVehicle(GetPlayerVehicleID(playerid)); 
                        } 
                    } 
                } 
                else 
                { 
                    
format(stringsizeof(string), "Invalid Group ID (groups vary from ID 1 to ID %d)."MAX_GROUPS); 
                    
SendClientMessage(playeridWHITEstring); 
                } 
            } 
            else 
            { 
                
SendClientMessage(playeridWHITE"You're not in a valid vehicle."); 
            } 
        } 
    } 
    return 
1

Reply
#2

bump
Reply
#3

Thats causing the problem

pawn Код:
if(IsAnOwnedCar(GetPlayerVehicleID(playerid)))
Reply
#4

Quote:
Originally Posted by Ultra-Gaming
Посмотреть сообщение
Thats causing the problem

pawn Код:
if(IsAnOwnedCar(GetPlayerVehicleID(playerid)))
Nope that is for when the car breaks down and you try to do /e
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)