little problem
#1

He guys, I have a script that only works for ID 0 and when ID 0 dives into a checkpoint other people will get a fish added too.

How to fix this?

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{

    if(fishprogress[playerid] == 1)
        {

        SendClientMessage(playerid,COLOR_DARKORANGE,"**Reeling in Fishes**");
        SetTimer("fishtimer",5000,false);
        fishes[playerid] += 1;
        TogglePlayerControllable(playerid,0);
        SetPlayerCheckpoint(playerid,3215.4434,-1035.6681,0.7980,4.0);
        fishprogress[playerid] = 2;
        }
        else
        if(fishprogress[playerid] == 2)
        {
        SendClientMessage(playerid,COLOR_DARKORANGE,"**Reeling in Fishes**");
        SetTimer("fishtimer",5000,false);
        fishes[playerid] += 1;
        TogglePlayerControllable(playerid,0);
        SetPlayerCheckpoint(playerid,3019.4819,-1259.1970,0.8884,4.0);
        fishprogress[playerid] = 3;
        }
        else
        if(fishprogress[playerid] == 3)
        {
        SendClientMessage(playerid,COLOR_DARKORANGE,"**Reeling in Fishes**");
        SetTimer("fishtimer",5000,false);
        fishes[playerid] += 1;
        TogglePlayerControllable(playerid,0);
        SetPlayerCheckpoint(playerid,3115.2380,-511.2403,0.9685,4.0);
        fishprogress[playerid] = 4;
        }
        else
        if(fishprogress[playerid] == 4)
        {
        SendClientMessage(playerid,COLOR_DARKORANGE,"**Reeling in Fishes**");
        SetTimer("fishtimer",5000,false);
        fishes[playerid] += 1;
        TogglePlayerControllable(playerid,0);
        SetPlayerCheckpoint(playerid,2979.5803,-8.0016,1.4147,4.0);
        fishprogress[playerid] = 5;
        }
        else
        if(fishprogress[playerid] == 5)
        {
        SendClientMessage(playerid,COLOR_DARKORANGE,"**Reeling in Fishes**");
        SetTimer("fishtimer",5000,false);
        fishes[playerid] += 1;
        TogglePlayerControllable(playerid,0);
        SetPlayerCheckpoint(playerid,2488.8032,472.4902,0.8335,4.0);
        fishprogress[playerid] = 6;
        }
        else
        if(fishprogress[playerid] == 6)
        {
        SendClientMessage(playerid,COLOR_DARKORANGE,"**Reeling in Fishes**");
        SetTimer("fishtimer",5000,false);
        fishes[playerid] += 1;
        TogglePlayerControllable(playerid,0);
        SetPlayerCheckpoint(playerid,2358.1958,518.7128,-0.3048,4.0);
        fishprogress[playerid] = 7;
        }
        else
        if(fishprogress[playerid] == 7)
        {
        SendClientMessage(playerid,COLOR_DARKORANGE,"Taking your fishes out of the boat");
        SetTimer("fishtimer",15000,false);
        fishes[playerid] += 1;
        TogglePlayerControllable(playerid,0);
        DisablePlayerCheckpoint(playerid);
        fishprogress[playerid] = 8;

        }

    return 1;
}
my command:
pawn Код:
COMMAND:fish(playerid,params[])
{
if(!IsPlayerInRangeOfPoint(playerid, 7.0, 2941.1365,-2051.7290,3.5480)) return SendClientMessage(playerid,COLOR_DARKORANGE,"You're not at the fishing place");
if(fishprogress[playerid] > 0) return SendClientMessage(playerid,COLOR_DARKORANGE,"You're already doing this job!");
else
fishprogress[playerid] = 1;
SendClientMessage(playerid,COLOR_DARKORANGE,"You've started your fishing job. Take a boat and go to the checkpoints!");
SetPlayerCheckpoint(playerid,3019.4819,-1259.1970,0.8884,4.0);
return 1;
}
Please help
Reply
#2

in the callback public OnPlayerEnterCheckpoint(playerid) you have to add something like

if(CHECKPOINT == FISHCP) // checks if the players in the cp

Or something like that
Reply
#3

SO I have to use a checkpoint streamer?...
I don't think so.
I've done this before.
Reply
#4

Sorry for the freaking to fast bump. But I really need to know this before I can go on.
Reply
#5

Can you show us the public fishtimer function?
Reply
#6

I'll send you guys the script.
It's small :P

http://pastebin.com/r3KXxmWc
Reply
#7

Well there's your problem, that function loops through everyone in the server and runs the code on them.

You need to make a function for a single person.
Reply
#8

Use

SetTimerEx
Reply
#9

Quote:
Originally Posted by jamesbond007
Посмотреть сообщение
Use

SetTimerEx
Well yes, but he'll also have to edit the function, as it currently loops through all players. Merely changing to SetTimerEx won't fix the issue.
Reply
#10

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Well yes, but he'll also have to edit the function, as it currently loops through all players. Merely changing to SetTimerEx won't fix the issue.
Then you can fix it, right?
Btw. how can the timer be wrong with this issue?
The fishes are given when he dives into a checkpoint. not at the timer.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)