Posts: 561
Threads: 27
Joined: Sep 2012
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(name,"KillerDVX",true))
{
new string[64];
format(string, sizeof(string),This car is owned by %s", name);
SendClientMessage(playerid, -1, string);
}
return 1;
}
Posts: 225
Threads: 62
Joined: Aug 2014
Reputation:
0
I still don't get how to create car for player...
Posts: 2,593
Threads: 34
Joined: Dec 2007
pawn Код:
// global
new gVehicleOwner[MAX_VEHICLES + 1] = {INVALID_PLAYER_ID, ...};
new vehicleid = CreateVehicle(411,0,0,0,2,-1,-1,3600);
gVehicleOwner[vehicleid] = playerid;
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(gVehicleOwner[vehicleid] != INVALID_PLAYER_ID)
if(gVehicleOwner[vehicleid] != playerid)
{
new string[64];
GetPlayerName(gVehicleOwner[vehicleid], string, MAX_PLAYER_NAME);
format(string, sizeof(string), "This car is owned by %s", string);
SendClientMessage(playerid, -1, string);
ClearAnimations(playerid);
}
return 1;
}
and for destroy
Change all DestroyVehicle to DestroyVehicleEx
pawn Код:
DestroyVehicleEx(vehicleid)
{
if(!(0 < vehicleid < sizeof(gVehicleOwner))) return 0;
gVehicleOwner[vehicleid] = INVALID_PLAYER_ID;
return DestroyVehicle(vehicleid);
}