SA-MP Forums Archive
RemovePlayerFromVehicle dont works - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: RemovePlayerFromVehicle dont works (/showthread.php?tid=331285)



RemovePlayerFromVehicle dont works - Gooday - 04.04.2012

I was creating a basic DMV system (test system)

pawn Код:
new DMV[MAX_PLAYERS]; //TOP

//OnPlayerConnect
DMV[playerid] = 0;

//EnterVehicle
.... Other Codes here
if(DMV[playerid] == 0){
    RemovePlayerFromVehicle(playerid);
      return 1;
 }


CMD:dmvtest(playerid,params[]) //Command to get the DMV
{
   DMV[playerid] = 1;
   return 1;
}
Nothing is working Player Can drive with DMV == 0 +REP


Re: RemovePlayerFromVehicle dont works - Reklez - 04.04.2012

put it OnPlayerStateChange.

pawn Код:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
    if(DMV[playerid] == 0)
    {
        RemovePlayerFromVehicle(playerid);
        return 1;
    }
}



Re: RemovePlayerFromVehicle dont works - aRoach - 04.04.2012

Reklez...
pawn Код:
if(DMV[playerid] == 0) return RemovePlayerFromVehicle(playerid);



Re: RemovePlayerFromVehicle dont works - Gooday - 04.04.2012

Thanks How could i save this? so when someone logs out doesn't need to type /dmv (I added a "test" system)? +REP


Re: RemovePlayerFromVehicle dont works - aRoach - 04.04.2012

Save it in your Accounts System, then when you load it ( at OnPlayerConnect ) if he had it to 1 make it enter to a car or what do you want...


Re: RemovePlayerFromVehicle dont works - Reklez - 04.04.2012

Save it OnPlayerDisconnect then check if DMV is set to 1 then do what ever you want to the user who have DMV set to 1


Re: RemovePlayerFromVehicle dont works - Gooday - 04.04.2012

Any example please :3


Re: RemovePlayerFromVehicle dont works - Reklez - 04.04.2012

What saving system are you using?


Re: RemovePlayerFromVehicle dont works - Gooday - 04.04.2012

pawn Код:
public OnPlayerConnect(playerid)
{

    if(fexist(UserPath(playerid))) {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"You are already registered, write your chosen password to log in! ","Login","Quit");
    }
    else {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to CC:RP , Our database tell us your new here, chose your password to register!","Register","Quit");
    }
    if(!IsRolePlayName(playerid)) {
        SendClientMessage(playerid, COLOR_RED, "(KICK) Please come back and use a RolePlay name! (Name_Surname)");
        Kick(playerid);
       //Stretche
    RemovePlayerAttachedObject(playerid, 0);
    Died[playerid] = 0;
    StretcherLoaded[playerid] = false;
    UsingStretcher[playerid] = false;
    PatientID[MedicID[playerid]] = -50;
    MedicID[PatientID[playerid]] = -50;
    MedicID[playerid] = -50;
    PatientID[playerid] = -50;
    Stretcher[playerid] = -50;
    Loaded2Stretcher[playerid] = false;
    StretcherSpawned[playerid] = false;
    return 1;
    }
    return 1;
}
This...


Re: RemovePlayerFromVehicle dont works - Reklez - 04.04.2012

ok we just use the same saving system

onplayerdisconnect in the line of saving part

pawn Код:
INI_WriteInt(file, "DMV", DMV[playerid]);