Scripting Help
#1

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
        {
         if(LicenseInfo[playerid][Car] < 1)
         {
         new tmp[32];
         SendClientMessage(playerid, 0xFF6347AA, "Ti nuk ke patent , lexo /patentat per me shum !!");
         RemovePlayerFromVehicle(playerid);
         TogglePlayerControllable( strval(tmp), true );
         return 1; }
}
    return 1;
}
This is a license script , so When i enter a car this appears : Ti nuk ke patent , lexo /patentat per me shum , means you dont have a license , but the problem is that when the text appears and RemovePlayerFromVehicle , it freezes me so i need to unfreeze myself with admin command , i tried to find a solution like TogglePlayerControllable( strval(tmp), true ); , but didnt work , any suggestions ?
Reply
#2

have u tried to eject the player by using setplayerpos ?
Reply
#3

Use TogglePlayerControllable(playerid, true);
Reply
#4

@Don_Cage , didnt work , still is freezing me
Reply
#5

Can anyone help me please ?
Reply
#6

I tried : #define SendPlayerCommand OnPlayerCommandText then
SendPlayerCommand(playerid, "/freeze");
SendPlayerCommand(playerid, "/unfreeze");
but still didnt work
Reply
#7

pawn Код:
// Method 1
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(LicenseInfo[playerid][Car] < 1)
        {
            SendClientMessage(playerid, 0xFF6347AA, "Ti nuk ke patent , lexo /patentat per me shum !!");
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid, true);
            return 1;
        }
    }
    return 1;
}

// Method 2
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(LicenseInfo[playerid][Car] < 1)
        {
            SendClientMessage(playerid, 0xFF6347AA, "Ti nuk ke patent , lexo /patentat per me shum !!");
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid, true);
            // Syncing purpose
            new Float: rPos[4], rPosEx[2];
            GetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
            GetPlayerFacingAngle(playerid, rPos[3]);
            rPosEx[0] = GetPlayerInterior(playerid);
            rPosEx[1] = GetPlayerVirtualWorld(playerid);
            PutPlayerInVehicle(playerid, 0, 0);
            SetPlayerPos(playerid, rPos[0], rPos[1], rPos[2]);
            SetPlayerFacingAngle(playerid, rPos[3]);
            SetPlayerInterior(playerid, rPosEx[0]);
            SetPlayerVirtualWorld(playerid, rPosEx[1]);
            return 1;
        }
    }
    return 1;
}
Try either.
Reply
#8

@Affan thanks for the scripts but both methods didnt work , here is the whole License script : http://pastebin.com/3vFWLCvA

If you can find another way , test it , here is the script , thanks very much .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)