SA-MP Forums Archive
How to stop a sendclientmessage from spamming - 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: How to stop a sendclientmessage from spamming (/showthread.php?tid=423394)



How to stop a sendclientmessage from spamming - Zalman - 17.03.2013

How would I make the sendclientmessage in this could stop from being spammed, And stop it from being looped so it on'y does it once and stops.

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
            {
                new vehicleid = GetPlayerVehicleID(playerid);
                new Float:vHP;
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleHealth(vehicleid, vHP);
                if(vHP < 400.00)
                {
                    SetVehicleHealth(vehicleid, 400.00);
                    SendClientMessage(playerid, YELLOW, "The vehicle has taken to much damage and has broken.");
                    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                    SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
                }
            }



Re: How to stop a sendclientmessage from spamming - Sinner - 17.03.2013

pawn Код:
if(GetPVarInt(playerid, "variable_name") == 0) {
    SetPVarInt(playerid, "variable_name", 1);
    // Code - will only be executed once
    // or until "variable_name" is set back to 0
}



Re: How to stop a sendclientmessage from spamming - Zalman - 17.03.2013

Quote:
Originally Posted by Sinner
Посмотреть сообщение
pawn Код:
if(GetPVarInt(playerid, "variable_name") == 0) {
    SetPVarInt(playerid, "variable_name", 1);
    // Code - will only be executed once
    // or until "variable_name" is set back to 0
}
Thank you.


Re: How to stop a sendclientmessage from spamming - Scenario - 17.03.2013

Can you post the full code, please?


Re: How to stop a sendclientmessage from spamming - Zalman - 17.03.2013

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Can you post the full code, please?
Here:

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
            {
                new vehicleid = GetPlayerVehicleID(playerid);
                new Float:vHP;
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleHealth(vehicleid, vHP);
                if(vHP < 400.00)
                {
                    if(GetPVarInt(playerid, "Vehicle_Breaking_Down") == 0) {
                        SetVehicleHealth(vehicleid, 400.00);
                        SendClientMessage(playerid, YELLOW, "The vehicle has taken to much damage and has broken.");
                        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                        SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
                        SetPVarInt(playerid, "Vehicle_Breaking_Down", 1);
                    }
                }
            }



Re: How to stop a sendclientmessage from spamming - Scenario - 17.03.2013

I'm assuming you fixed it, then?


Re: How to stop a sendclientmessage from spamming - Zalman - 17.03.2013

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I'm assuming you fixed it, then?
Yes thanks anyways though.