Car system problems
#1

NOT SOLVED STILL. When i enter vehicles it ALWAYS says [ ! ] ID : 0 ' Turismo ' Bought by: Coole210 even if i enter second car !!

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new string[128];
    if(Cars[GetPlayerVehicleID(playerid)][cOwner] == 1)
    {
    format(string,sizeof(string),"[ ! ] ID : %d ' %s ' Bought by : %s",Cars[GetPlayerVehicleID(playerid)][cCarID],Cars[GetPlayerVehicleID(playerid)][cDescription],Cars[GetPlayerVehicleID(playerid)][cOwner]);
    SendClientMessage(playerid,COLOR_GREY,string);
    }
  if(Cars[GetPlayerVehicleID(playerid)][cOwned] == 0)
  {
  format(string,sizeof(string),"[ ! ] ID : %d ' %s ' Price : %d RCASH",Cars[GetPlayerVehicleID(playerid)][cCarID],Cars[GetPlayerVehicleID(playerid)][cDescription],Cars[GetPlayerVehicleID(playerid)][cPrice]);
  SendClientMessage(playerid,COLOR_GREY,string);
  }
  if(Cars[GetPlayerVehicleID(playerid)][cOwned] == 1)
  {
  format(string,sizeof(string),"[ ! ] ID : %d ' %s ' Bought by : %s",Cars[GetPlayerVehicleID(playerid)][cCarID],Cars[GetPlayerVehicleID(playerid)][cDescription],Cars[GetPlayerVehicleID(playerid)][cOwner]);
  SendClientMessage(playerid,COLOR_GREY,string);
  }
    return 1;
}
Reply
#2

Код:
[quote]
Okay my car system works fine with 1 car but when i add second car i enter car and it says BOTH cars ! Car ID : 1 Infernus and Car ID : 0 Turismo and when i try to buy the second car ( ID 1 ) it buys the first 1 !!
OnPlayerStateChange&OnPlayerEnterVehicle
Reply
#3

Thats just going to change messages if i fix that and ALSO, you didnt tell me how to change that :S
Reply
#4

Sorry for my lazy.
I cannot find any problem from your code, so I need more code(StateChange&EnterVehicle)
Reply
#5

[SOLVED]
Reply
#6

Deleted sory I didn't see the code lol
Reply
#7

[SOLVED]
Reply
#8

[SOLVED]
Reply
#9

[SOLVED]
Reply
#10

Why is there a 'while' statement in that code? (the /buy command)
If you're trying to determine if the car that the player is in is owned, then you should use GetPlayerVehicleID(playerid)-1 (-1 because there is no vehicle ID 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)