RemovePlayerFromVehicle dont works
#1

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
Reply
#2

put it OnPlayerStateChange.

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

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

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

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...
Reply
#6

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
Reply
#7

Any example please :3
Reply
#8

What saving system are you using?
Reply
#9

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...
Reply
#10

ok we just use the same saving system

onplayerdisconnect in the line of saving part

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


Forum Jump:


Users browsing this thread: 1 Guest(s)