26.02.2010, 13:13
hi, my /lock command works for all cars, i wan't to make it to work only for my own car. if i don't got it it says like: you dont got car.
it should look like:
The problem is i don't know how to get player's car... HELP ME !
Код:
if(strcmpEx(cmd, "/lock", true) == 0)
{
if(VehicleLockedPlayer[playerid] != 999)
{
SendClientMessage(playerid, COLOR_WHITE, "You must first unlock your previous vehicle.");
return 1;
}
new carid = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(VehicleLocked[carid] == 0)
{
if(pStats[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"has just locked his vehicle.");
}
else
{
PlayerActionMessage(playerid,15.0,"has just locked her vehicle.");
}
SendClientMessage(playerid,COLOR_WHITE,"Vehicle Locked.");
VehicleLocked[carid] = 1;
VehicleLockedPlayer[playerid] = carid;
}
if(VehicleLocked[carid] == 1)
{
if(pStats[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"has just unlocked his vehicle.");
}
else
{
PlayerActionMessage(playerid,15.0,"has just unlocked her vehicle.");
}
SendClientMessage(playerid,COLOR_WHITE,"Vehicle Unlocked.");
VehicleLocked[carid] = 0;
VehicleLockedPlayer[playerid] = 999;
}
}
else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
new Float:x,Float:y,Float:z;
if(VehicleLockedPlayer[playerid] != 999)
{
GetVehiclePos(VehicleLockedPlayer[playerid], x, y, z);
}
if(VehicleLocked[VehicleLockedPlayer[playerid]])
{
if(PlayerToPoint(5.0,playerid,x,y,z) || GetPlayerVehicleID(playerid) == VehicleLockedPlayer[playerid])
{
if(pStats[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,15.0,"has just unlocked his vehicle.");
}
else
{
PlayerActionMessage(playerid,15.0,"has just unlocked her vehicle.");
}
SendClientMessage(playerid,COLOR_WHITE,"Vehicle Unlocked.");
VehicleLocked[VehicleLockedPlayer[playerid]] = 0;
VehicleLockedPlayer[playerid] = 999;
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"You're unable to (un)lock your feet.");
}
}
}
Код:
if(pStats[playerid][pCarModel] == 0;)
{
SendClientMessage(playerid,COLOR_WHITE,"You don't have your own car");
} else {
if(VehicleLocked[carid] == 0)
{
VehicleLocked[carid] = 1;
SendClientMessage(playerid,COLOR_WHITE,"Car has been locked");
}
if(VehicleLocked[carid] == 1)
{
VehicleLocked[carid] = 0;
SendClientMessage(playerid,COLOR_WHITE,"Car has been unlocked");
}
}

