little bug
#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 код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
vehicleid == Veh || Veh2 || Veh3 || Veh4 || Veh5)
        {
            if(
PlayerInfo[playerid][MemberGSF] >= || PlayerInfo[playerid][LeaderGSF] >= 1)
            {
                
SendClientMessage(playeridCOLOR_LIMEGREEN"You have entered your organization vehicle!");
            }
            else
            {
                
SendClientMessage(playeridCOLOR_RED"Error: You are not a member of Grove Street Families!");
                
RemovePlayerFromVehicle(playerid);
            }
        }
    }
    return 
1;

Reply
#2

Quote:
Originally Posted by saffierr
Посмотреть сообщение
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 код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
vehicleid == Veh || Veh2 || Veh3 || Veh4 || Veh5)
        {
            if(
PlayerInfo[playerid][MemberGSF] >= || PlayerInfo[playerid][LeaderGSF] >= 1)
            {
                
SendClientMessage(playeridCOLOR_LIMEGREEN"You have entered your organization vehicle!");
            }
            else
            {
                
SendClientMessage(playeridCOLOR_RED"Error: You are not a member of Grove Street Families!");
                
RemovePlayerFromVehicle(playerid);
            }
        }
    }
    return 
1;

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(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
v_clan_gsf[vehicleid])
        {
            if(
PlayerInfo[playerid][MemberGSF] >= && PlayerInfo[playerid][LeaderGSF] >= 1)
            {
                
SendClientMessage(playeridCOLOR_LIMEGREEN"You have entered your organization vehicle!");
            }
            else
            {
                new
                     
Float:xFloat:yFloat:z
                
;
                
GetPlayerPos(playeridxyz);
                
SendClientMessage(playeridCOLOR_RED"Error: You are not a member of Grove Street Families!");
                
SetPlayerPos(playeridxyz);
                
// Or RemovePlayerFromVehicle(playerid);
            
}
        }
    }
    return 
1;

Reply
#3

Thanks, it's been solved.
what was the difference between yours and mine, lol...? what was the big deal?
Reply
#4

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Thanks, it's been solved.
what was the difference between yours and mine, lol...? what was the big deal?
Difference. For routine operations, and storage arrays are better than just variables. You will be comfortable working with an array - it will come with experience.
Reply
#5

Yeah I hope so, but why do I have to use Floats lol...
How is that needed?
Reply
#6

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Yeah I hope so, but why do I have to use Floats lol...
How is that needed?
And where did you see Float
bool - a bit variable, the fastest of all existing, used for logical comparison. It has only two states, 1 - true, 2 - false
Reply
#7

Not in the bool.

In the OnPlayerStateChange
You added Floats
Reply
#8

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Not in the bool.

In the OnPlayerStateChange
You added Floats
You about this?

PHP код:
new
                     
Float:xFloat:yFloat:z
                
;
                
GetPlayerPos(playeridxyz);
                
SendClientMessage(playeridCOLOR_RED"Error: You are not a member of Grove Street Families!");
                
SetPlayerPos(playeridxyz); 
This is the case unless the player withdraws from car. If call SetPlayerPos it will be removed from car. This Alt. RemovePlayerFromVehicle
Reply
#9

Exactly, why are those Floats needed was my simple question.
Reply
#10

For, GetPlayerPos and SetPlayerPos . you can see it.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)