Need help for a little thing - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help for a little thing (
/showthread.php?tid=94958)
Need help for a little thing -
Alice[WS] - 01.09.2009
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);
}
}
Re: Need help for a little thing -
JaTochNietDan - 01.09.2009
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.
Re: Need help for a little thing -
coole210 - 02.09.2009
....
Re: Need help for a little thing -
Alice[WS] - 02.09.2009
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
Re: Need help for a little thing -
Alice[WS] - 02.09.2009
bump
Re: Need help for a little thing -
Alice[WS] - 02.09.2009
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