public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
if(!IsVehicleOwner(plyerid, vehicleid))
{
SendClientMessage(playerid, 0xFF0000FF, "this is not your vehicle");
print("not yours");
//eject
}
printf("Name lenght: %i | Awesome ID: %i | Owner: %s", strlen(GetVehicleOwner(vehicleid)), AwesomeVehicleID(vehicleid), GetVehicleOwner(vehicleid));
}
return 1;
}
stock IsVehicleOwner(playerid, vehicleid)
{
new awesomeid = AwesomeVehicleID(vehicleid);
if((awesomeid != 0)
&& (strmatch(PlayerName(playerid), VehicleData[awesomeid][VehicleOwner]))) return 1; // if "awesomeid is not 0 && player name match with vehicle name then return true (yes)
return 0; // else return false (no)
}
not yours Name lenght: 0 | Awesome ID: 0 | Owner:
pawn Код:
Код:
not yours Name lenght: 0 | Awesome ID: 0 | Owner: |
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
if(!IsVehicleOwner(playerid, vehicleid))//<- You had plyerid
{
SendClientMessage(playerid, 0xFF0000FF, "this is not your vehicle");
print("not yours");
//eject
}
printf("Name lenght: %i | Awesome ID: %i | Owner: %s", strlen(GetVehicleOwner(vehicleid)), AwesomeVehicleID(vehicleid), GetVehicleOwner(vehicleid));
}
return 1;
}
stock IsVehicleOwner(playerid, vehicleid)
{
if(AwesomeVehicleID(vehicleid) != 0 && strmatch(PlayerName(playerid), VehicleData[awesomeid][VehicleOwner])) return 1;
return 0;
}
new awesomeid = AwesomeVehicleID(vehicleid)
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
if(!IsVehicleOwner(plyerid, vehicleid) && AwesomeVehicleID(vehicleid) != 0)
{
SendClientMessage(playerid, 0xFF0000FF, "this is not your vehicle");
print("not yours");
//eject
}
printf("Name lenght: %i | Awesome ID: %i | Owner: %s", strlen(GetVehicleOwner(vehicleid)), AwesomeVehicleID(vehicleid), GetVehicleOwner(vehicleid));
}
return 1;
}
stock IsVehicleOwner(playerid, vehicleid)
{
if(strmatch(PlayerName(playerid), VehicleData[awesomeid][VehicleOwner])) return true:
return false;
}