SA-MP Forums Archive
Flood - 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: Flood (/showthread.php?tid=407785)



Flood - Louris - 15.01.2013

Код:
public OnPlayerUpdate(playerid)
{
    new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
        if(GetPlayerSpeed(playerid) > 270)
TogglePlayerControllable(playerid,0);
        format(string, sizeof(string), "%s Vaћiavo didesniu nei 270 km/h greičiu. /stebeti %s", name);
if(PlayerInfo[playerid][pAdmin] == 1)
SendClientMessage(playerid, -1, string);
    return 1;
}
This code flood this line:

format(string, sizeof(string), "%s Vaћiavo didesniu nei 270 km/h greičiu. /stebeti %s", name);

When i not going 270 km/h speed.


Re: Flood - ]Rafaellos[ - 15.01.2013

I think that happened because is on "public OnPlayerUpdate(playerid)"


Re: Flood - Louris - 15.01.2013

Where i should put it?


Re: Flood - Jeffry - 15.01.2013

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetPlayerSpeed(playerid) > 270)
    {
        TogglePlayerControllable(playerid,0);
        new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "%s Važiavo didesniu nei 270 km/h greičiu. /stebeti %s", name, name);
        for(new i=0; i<MAX_PLAYERS; i++) if(PlayerInfo[i][pAdmin] == 1) SendClientMessage(i, -1, string);
    }
    return 1;
}
This way it should work.
I suppose you want that admins see the message when a player exceeds the speed. That's why I added the loop, else only the player who exceeds the limit will get the message.


Re: Flood - Louris - 15.01.2013

Thank you, it works.