Big problem with variables
#1

I was trying to make variables that only a player who belongs to a Faction1 can use a certain car, I have no warnings nothing everything is defined, I even open a File on "users" to check everything, the problem is when I log in game and enter every car It "slaps" me spawns me where I started and doesn't say a thing, can anyone fix my script ?
This is the whole script, there are only few "new" at the top, nothing more.

PHP код:
public OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
new 
tmp[256];
new 
idx;
new 
cmdtext[256];
new 
string[64];
tmp strtok(cmdtextidx);
 new 
vehicleid GetPlayerVehicleID(playerid);
  if(
newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
  if(
vehicleid == na1)
if(
dini_Exists(faction1)) {
GetPlayerPos(otherIdslxslyslz);
        
SetPlayerPos(otherIdslxslyslz+5);
                
format(stringsizeof(string), "Vehicle Faction !"playername1);
                
SendClientMessage(playerid0xFF4646Fstring);
return 
1;
}
            if(
strcmp(PlayerName(playerid),faction1true) != 0)
            if(!
dini_Exists(faction1)) { dini_Create(faction1);
 
dini_Set(faction1,"pass",tmp);
 
logged[playerid] = 1format(stringsizeof(string), " You are in a faction, congratulations"playername1tmp);
 
SendClientMessage(playerid0xFF4646FFstring); }
 
SetPlayerPos(playerid,1270.0521,-1557.4521,13.5625);
        return 
1;

Reply
#2

Supposed to get if the player enters the faction car, and also...

pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
{

//NOT

if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
EDIT: Like

pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
{
        if(IsPlayerInAnyVehicle(playerid) == FACTIONCAR)
        {
                if(IsPlayerInFaction(playerid)) return 1;
        }
}
Something like that.

EDIT 2: Don't use PHP Code use
[ pawn ] [ /pawn ]

without the spaces.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)