public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == Veh || Veh2 || Veh3 || Veh4 || Veh5)
{
if(PlayerInfo[playerid][MemberGSF] >= 1 || PlayerInfo[playerid][LeaderGSF] >= 1)
{
SendClientMessage(playerid, COLOR_LIMEGREEN, "You have entered your organization vehicle!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Error: You are not a member of Grove Street Families!");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
|
A little bug, It removes me from every car in the map, while I want it just for the 5 cars from GSF. If you're not a GSF member it removes me from everycar in the map. Please help, how do I change it to just: If you're not a GSF member you cannot drive a GSF vehicle.
PHP код:
|
new bool:v_clan_gsf[MAX_VEHICLES];
public OnGameModeInit() {
//... = CreateVehicle();
v_clan_gsf[1] = true; // Vehicle ID 1 in clan GSF
v_clan_gsf[20] = true; // etc..
v_clan_gsf[10] = true; // EOF Vehicles of clan GSF
return true;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(v_clan_gsf[vehicleid])
{
if(PlayerInfo[playerid][MemberGSF] >= 1 && PlayerInfo[playerid][LeaderGSF] >= 1)
{
SendClientMessage(playerid, COLOR_LIMEGREEN, "You have entered your organization vehicle!");
}
else
{
new
Float:x, Float:y, Float:z
;
GetPlayerPos(playerid, x, y, z);
SendClientMessage(playerid, COLOR_RED, "Error: You are not a member of Grove Street Families!");
SetPlayerPos(playerid, x, y, z);
// Or RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
|
Thanks, it's been solved.
what was the difference between yours and mine, lol...? what was the big deal? |
|
Yeah I hope so, but why do I have to use Floats lol...
How is that needed? |
new
Float:x, Float:y, Float:z
;
GetPlayerPos(playerid, x, y, z);
SendClientMessage(playerid, COLOR_RED, "Error: You are not a member of Grove Street Families!");
SetPlayerPos(playerid, x, y, z);