Need help for a little thing
#1

I tried to add a system on my GM, when a player enter in a car, it shows its owner. But it's like bugged ...

I made some tests, and the system works, but only when it's not a String ...

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if (IsAnOwnedCar(vehicleid) && !ispassenger)
	  {
		SendClientMessage(playerid,0xAFAFAFAA,"message test");   //NOT BUGGED
		}
}
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if (IsAnOwnedCar(vehicleid) && !ispassenger)
	  {
           format(lvehicle, sizeof(lvehicle), "Owner : %d", CARSHOP[vehicleid][Owner]);  // BUGGED
		SendClientMessage(playerid,0xAFAFAFAA,lvehicle);
	  }
}
Reply
#2

I'm not sure what you mean by the string bit since they are all strings. However this should be a fix.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (IsAnOwnedCar(vehicleid) && !ispassenger)
    {
        format(lvehicle, sizeof(lvehicle), "Owner : %s", CARSHOP[vehicleid][Owner]);  // BUGGED
        SendClientMessage(playerid,0xAFAFAFAA,lvehicle);
    }
    return 1;
}
We use %s as %d defines it as an integer value and not a string.
Reply
#3

....
Reply
#4

Thanks JaTochNietDan, it worked well. Now i added some stuffs, like the car ID and Model, but i get an error while i did the vehicle model part.

Код:
	if (IsAnOwnedCar(vehicleid) && !ispassenger)
	  {
	  new string[MAX_STRING];
	  new ID = GetPlayerVehicleID(playerid);
	  new carname[MAX_STRING];
		carname = LVehiclesName[GetVehicleModel(GetPlayerVehicleID(playerid))-400];
		format(string, sizeof(string), "[ ! ] ID : %d \' %s \' Achetйe par : %s", ID, carname, CARSHOP[vehicleid][Owner]);
		SendClientMessage(playerid,0xAFAFAFAA, string);
		}
	return 1;
Код:
C:\Desktop\ServeurGTA\gamemodes\RP.pwn(1169) : error 047: array sizes do not match, or destination array is too small
Reply
#5

bump
Reply
#6

Quote:
Originally Posted by ► James_Alex
try to do
pawn Код:
if (IsAnOwnedCar(vehicleid) && !ispassenger)
      {
      new string[MAX_STRING];
      new ID = GetPlayerVehicleID(playerid);
      new carname[MAX_STRING];
        strmid(carname, LVehiclesName[GetVehicleModel(GetPlayerVehicleID(playerid))-400], 0, strlen(LVehiclesName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]), 255);
        format(string, sizeof(string), "[ ! ] ID : %d \' %s \' Achetйe par : %s", ID, carname, CARSHOP[vehicleid][Owner]);
        SendClientMessage(playerid,0xAFAFAFAA, string);
        }
    return 1;
now it works
mnt зa marche
teste le
Yes it works, but only for compilation . Now when a player enter in a car nothing happens
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)