SA-MP Forums Archive
I need help! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: I need help! (/showthread.php?tid=271840)



I need help! - Pasa - 26.07.2011

I am making a bus job and i so far have made the CP-s and in mta i have added some objects but i dont know how when the player is in the CP to lock the camera fot example 30 sec. and one texddraw show that says "Picking the people"!


can anybody say how can i do this?

sry for bad english


Re: I need help! - Pasa - 26.07.2011

TogglePlayerControllable(playerid,0); this frezze the player now how i can make for 30 sec unfreeze the player?


Re: I need help! - Rolyy - 26.07.2011

Try to experience with this:
https://sampwiki.blast.hk/wiki/SetTimer
pawn Код:
SetTimer("unfreezeplayer", 30000, false); // Set a timer of 1000 miliseconds (1 second) - Now how much is 30 x 1000? = 30000
And in the public use:
pawn Код:
for(new all=0; all < MAX_PLAYERS; all++)
{
    TogglePlayerControllable(all, 0); //So player can controle himself again
}



Re: I need help! - Pasa - 26.07.2011

edit:

I have remove the code for the safety reasons!!


Re: I need help! - Rafa - 26.07.2011

pawn Код:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
forward unfreezeplayer();

new BusJob[256];
public unfreezeplayer();
{
      TogglePlayerControllable(all, 1);
}
public OnFilterScriptInit()
{
     
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/ruta1", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 437)
        {
            BusJob[playerid] = 1;
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "* %s vozi rutu jedan.", name );
            SendClientMessageToAll(COLOR_YELLOW, string);
            SetPlayerCheckpoint(playerid,1246.2437,-1847.1620,13.5907,5);
            SendClientMessage(playerid,COLOR_YELLOW,"* Prati crvene markere na radaru da bi zaraio nesto para!");
            return 1;
        }
        SendClientMessage(playerid, COLOR_RED,"Moras biti u autobusu za prijevoz putnika da bi radio rutu!");
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 437)
     {
         SendClientMessage(playerid, COLOR_RED, "*Sad mozes krenuti sa prevozom putnika ~/ruta1~");
     }
     return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 437)
     {
        if(BusJob[playerid] == 1){
            BusJob[playerid] = 2;
            SetPlayerCheckpoint(playerid,1042.0785,-1760.6067,13.5953,5);
            SetTimer("unfreezeplayer", 30000, false);
            for(new all=0; all < MAX_PLAYERS; all++)
            {
                   TogglePlayerControllable(all, 0);
                   return 1;
            }
        if(BusJob[playerid] == 2){
            BusJob[playerid] = 3;
            SetPlayerCheckpoint(playerid,1001.4951,-1485.8391,13.5637,5);
            return 1;
           }
        if(BusJob[playerid] == 3){
            BusJob[playerid] = 4;
            SetPlayerCheckpoint(playerid,842.0739,-1392.3109,13.5187,5);
            return 1;
         }
        if(BusJob[playerid] == 4){
            BusJob[playerid] = 5;
            SetPlayerCheckpoint(playerid,497.3190,-1448.8719,16.2296,5);
            return 1;
         }
        if(BusJob[playerid] == 5){
            BusJob[playerid] = 6;
            SetPlayerCheckpoint(playerid,380.4133,-1643.3300,32.7374,5);
            return 1;
         }
        if(BusJob[playerid] == 6){
            BusJob[playerid] = 7;
            SetPlayerCheckpoint(playerid,375.1918,-2028.4211,7.8789,5);
            return 1;
         }
        if(BusJob[playerid] == 7){
            BusJob[playerid] = 8;
            SetPlayerCheckpoint(playerid,620.7009,-1697.9086,15.4668,5);
            return 1;
         }
        if(BusJob[playerid] == 8){
            BusJob[playerid] = 9;
            SetPlayerCheckpoint(playerid,737.8829,-1780.7576,13.2861,5);
            return 1;
         }
        if(BusJob[playerid] == 9){
            BusJob[playerid] = 10;
            SetPlayerCheckpoint(playerid,1236.9111,-1855.8455,13.5165,5);
            return 1;
         }
        if(BusJob[playerid] == 11){
            BusJob[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid,COLOR_YELLOW,"* Zaradio si 200$ na prevozom putnika.");
            GivePlayerMoney(playerid,200);
         }
     }
     return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(BusJob[playerid] > 0)
    {
        BusJob[playerid] = 0;
        SendClientMessage(playerid, COLOR_RED, "* Napustio si autobus,prevoz putnika prekinut.");
        DisablePlayerCheckpoint(playerid);
    }
}
its not tested i just folow the wiki exsample..
u add the rest of the code..
Sorry if im wrong :/


Re: I need help! - [MG]Dimi - 26.07.2011

Quote:

for(new all=0; all < MAX_PLAYERS; all++)
{
TogglePlayerControllable(all, 0);

Why freezeing everyone. I think that only driver should be frozen


Re: I need help! - Pasa - 26.07.2011

jes dimi, but this don't work :S


Re: I need help! - [MG]Dimi - 26.07.2011

You have to define every Checkpoint and thenm under
PHP код:
OnPlayerEnterCheckpoint(playerid)
{
if([
CP name] == 1)
{
Here call function for freezeingcreate timer for unfreeze and Set new CP 
P.S.Vidim da pricas Srpski pa ako oces da ti pomognem posalji mi PM


Re: I need help! - Pasa - 26.07.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
You have to define every Checkpoint and thenm under
PHP код:
OnPlayerEnterCheckpoint(playerid)
{
if([
CP name] == 1)
{
Here call function for freezeingcreate timer for unfreeze and Set new CP 
P.S.Vidim da pricas Srpski pa ako oces da ti pomognem posalji mi PM
javio sam ti se na pm!


Re: I need help! - Rafa - 26.07.2011

try this one:
pawn Код:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
new BusJob[256];
forward unfreezeplayer();
public OnFilterScriptInit()
{

}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/ruta1", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 437)
        {
            BusJob[playerid] = 1;
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "* %s vozi rutu jedan.", name );
            SendClientMessageToAll(COLOR_YELLOW, string);
            SetPlayerCheckpoint(playerid,1246.2437,-1847.1620,13.5907,5);
            SendClientMessage(playerid,COLOR_YELLOW,"* Prati crvene markere na radaru da bi zaraio nesto para!");
            return 1;
        }
        SendClientMessage(playerid, COLOR_RED,"Moras biti u autobusu za prijevoz putnika da bi radio rutu!");
        return 1;
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 437)
     {
         SendClientMessage(playerid, COLOR_RED, "*Sad mozes krenuti sa prevozom putnika ~/ruta1~");
     }
     return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 437)
     {
        if(BusJob[playerid] == 1){
        BusJob[playerid] = 2;
        SetPlayerCheckpoint(playerid,1042.0785,-1760.6067,13.5953,5);
        SetTimer("unfreezeplayer", 30000, false);
        {
            TogglePlayerControllable(playerid, 0);
        }
        if(BusJob[playerid] == 2)
        {
            BusJob[playerid] = 3;
            SetPlayerCheckpoint(playerid,1001.4951,-1485.8391,13.5637,5);
            SetTimer("unfreezeplayer", 30000, false);
            {
                TogglePlayerControllable(playerid, 0);
            }
            return 1;
        }
        if(BusJob[playerid] == 3)
        {
            BusJob[playerid] = 4;
            SetPlayerCheckpoint(playerid,842.0739,-1392.3109,13.5187,5);
            SetTimer("unfreezeplayer", 30000, false);
            {
                TogglePlayerControllable(playerid, 0);
            }
            return 1;
        }
        if(BusJob[playerid] == 4)
        {
            BusJob[playerid] = 5;
            SetPlayerCheckpoint(playerid,497.3190,-1448.8719,16.2296,5);
            SetTimer("unfreezeplayer", 30000, false);
            {
                TogglePlayerControllable(playerid, 0);
            }
            return 1;
        }
        if(BusJob[playerid] == 5)
        {
            BusJob[playerid] = 6;
            SetPlayerCheckpoint(playerid,380.4133,-1643.3300,32.7374,5);
            SetTimer("unfreezeplayer", 30000, false);
            {
                TogglePlayerControllable(playerid, 0);
            }
            return 1;
        }
        if(BusJob[playerid] == 6)
        {
            BusJob[playerid] = 7;
            SetPlayerCheckpoint(playerid,375.1918,-2028.4211,7.8789,5);
            SetTimer("unfreezeplayer", 30000, false);
            {
                TogglePlayerControllable(playerid, 0);
            }
            return 1;
        }
        if(BusJob[playerid] == 7)
        {
            BusJob[playerid] = 8;
            SetPlayerCheckpoint(playerid,620.7009,-1697.9086,15.4668,5);
            SetTimer("unfreezeplayer", 30000, false);
            {
                TogglePlayerControllable(playerid, 0);
            }
            return 1;
        }
        if(BusJob[playerid] == 8)
        {
            BusJob[playerid] = 9;
            SetPlayerCheckpoint(playerid,737.8829,-1780.7576,13.2861,5);
            SetTimer("unfreezeplayer", 30000, false);
            {
                TogglePlayerControllable(playerid, 0);
            }
            return 1;
        }
        if(BusJob[playerid] == 9)
        {
            BusJob[playerid] = 10;
            SetPlayerCheckpoint(playerid,1236.9111,-1855.8455,13.5165,5);
            SetTimer("unfreezeplayer", 30000, false);
            {
                TogglePlayerControllable(playerid, 0);
            }
            return 1;
        }
        if(BusJob[playerid] == 11)
        {
            BusJob[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid,COLOR_YELLOW,"* Zaradio si 200$ na prevozom putnika.");
            GivePlayerMoney(playerid,200);
        }
     }
  }
     return 1;
}
public unfreezeplayer();
{
    TogglePlayerControllable(playerid, 1);
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(BusJob[playerid] > 0)
    {
        BusJob[playerid] = 0;
        SendClientMessage(playerid, COLOR_RED, "* Napustio si autobus,prevoz putnika prekinut.");
        DisablePlayerCheckpoint(playerid);
        return 1;
    }
    return 1;
}