08.01.2013, 17:16
Lets get to the problem shall we?
I print out this vehicles owner and it says my name (as i just bought it)
I'm now checking if its my car, for some reason it would always kick me, so i added the print line and printed the vehicles owner variable and it returned nothing (null)
So what am i doing wrong?
pawn Код:
new ID = 0;
while(ID < sizeof(vehicles) && vehicles[ID])
{
ID++;
}
VehicleInfo[ID][owner] = PlayerName(playerid);
printf("owner: %s", VehicleInfo[ID][owner]);
VehicleInfo[ID][model] = 411;
VehicleInfo[ID][value] = 500;
VehicleInfo[ID][pannel_damage] = 0;
VehicleInfo[ID][door_damage] = 0;
VehicleInfo[ID][light_damage] = 0;
VehicleInfo[ID][tire_damage] = 0;
VehicleInfo[ID][owned] = true;
vehicle_creating =ID;
pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new Vehicleid = GetPlayerVehicleID(playerid);
printf("vehicle owned by: %s", VehicleInfo[Vehicleid][owner]);
if(!strcmp(VehicleInfo[Vehicleid][owner], PlayerName(playerid), true))
{
SendClientMessage(playerid, -1, "This is not your vehicle");
RemovePlayerFromVehicle(playerid);
}
}
So what am i doing wrong?