SA-MP Forums Archive
why wont this work ? - 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: why wont this work ? (/showthread.php?tid=285623)



why wont this work ? - [LHT]Bally - 24.09.2011

i have probably got it totally wrong but here goes

if i type /overload i want it so that i must be in range of a place otherwise it wont work and will send the message ERROR: you are not in range of such a place

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

            if(!strcmp(cmdtext, "/overload"))
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 1286, 836.40002441406, 4.9000000953674))
        SetPlayerWantedLevel( playerid, 2 );// change to what you like
        GameTextForPlayer(playerid, "~r~YOU ARE OVERLOADED~n~~g~AVOID THE POLICE", 3000, 3);//change to what you want between the ""
        PlayCrimeReportForPlayer(playerid, playerid, 16);
            }
            else
            {
            SendClientMessage(playerid, COLOR_WHITE, "You are not on a weigh bridge");
            }
            return 1;
            }



Re: why wont this work ? - Redgie - 24.09.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/overload"))
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 1286, 836.40002441406, 4.9000000953674))
        {
            SetPlayerWantedLevel( playerid, 2 );// change to what you like
            GameTextForPlayer(playerid, "~r~YOU ARE OVERLOADED~n~~g~AVOID THE POLICE", 3000, 3);//change to what you want between the ""
            PlayCrimeReportForPlayer(playerid, playerid, 16);
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You are not on a weigh bridge");
        }
    }
    return 1;
}
You just had your brackets a little mixed up, format your code properly and it's easier to see.


Re: why wont this work ? - [LHT]Bally - 24.09.2011

thankyou i thought it would have been simple but imjust learning


Re: why wont this work ? - Redgie - 24.09.2011

No problem, just keep your brackets in line with eachother and it's much easier to code and fix the code you've made