#1

I want to make when someone is enter in some vehicle with owner, or maybe faction and IDK to make showing name of faction like this OWNER: FBI, OWNER: Connor_Smith, my script is on MYSQL.

sorry for my bad english
Reply
#2

Anyone please?
Reply
#3

i can't help in MySql db but i think no1 can help without knowing the way that ur script work with. (to check if the vehicle owned by a faction or a player)
Reply
#4

to check if the vehicle owned by a player and faction too
Reply
#5

first you need a value(data) of veh owner/faction for save/load
PHP код:
new CarOwner[MAX_VEHICLES][MAX_PLAYER_NAME], Bool:CarOwned[MAX_VEHICLES], VehType[MAX_VEHICLES], PlayerFaction[MAX_PLAYERS];//it just example, you can use in enumerations or something you want
public OnGameModeInit()
{
   
LoadCars();
   return 
1;
}
static 
LoadCars()
{
    ...
mysql query etc..
    
cache_get_value_name_int(idx"faction"VehType[vehicleid]); // load veh faction
    
cache_get_value_name_null(idx"owned"CarOwned[vehicleid]); //load owner
    
cache_get_value_name(idx"owner"CarOwner[vehicleid]); //load owner
    
...
}
static 
SaveCars()
{
    ...
mysql query to save/update car value with faction&owner etc..

also load player data PlayerFaction when player login,
and you can check when player entered in veh

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
CarOwned[vehicleid])
        {
            static 
string[64];
            
format(stringsizeof(string), "This car owner is : %s"CarOwner[vehicleid]);
            
SendClientMessage(playerid, -1string);
        }
        if(
VehType[vehicleid] != PlayerFaction[playerid])
        {
            static 
string[64], factname[32];
            switch(
VehType[vehicleid]){
                case 
1:{
                    
format(factnamesizeof(factname), "FBI");
                }
                default:{
                    
format(factnamesizeof(factname), "NONE");
                }
            }
            
format(stringsizeof(string), "This car is Faction: %s"factname);
            
SendClientMessage(playerid, -1string);
        }
    }
    return 
1;

this just a example,
you can make more good and great by youself!
Reply
#6

Thanks I will try to do it, if I need more help, Im gonna write here )
Reply
#7

I need help again

Код:
Car_GetCount(playerid)
{
	new
		count = 0;

	for (new i = 0; i != MAX_DYNAMIC_CARS; i ++)
	{
		if (CarData[i][carExists] && CarData[i][carOwner] == PlayerData[playerid][pCharacter])
   		{
   		    count++;
		}
	}
	return count;
}

Car_IsOwner(playerid, carid)
{
	if (!PlayerData[playerid][pLogged] || PlayerData[playerid][pID] == -1)
	    return 0;

    if ((CarData[carid][carExists] && CarData[carid][carOwner] != 0) && CarData[carid][carOwner] == PlayerData[playerid][pCharacter])
		return 1;

	return 0;
}

Car_Create(playerid)

CarData[i][carOwner] = owner;

Car_Delete

CarData[carid][carOwner] = 0;

Car_Save

carOwner` = '%s'
And its showing this in mysql table http://prntscr.com/dby2rc
Reply
#8

Anyone help?
Reply
#9

Hello?
Reply
#10

do you mean that thing in picture is showing at mysql car owner field?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)