SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 19/10/2019, 05:26 PM   #1
Little Clucker
PopularTech's Avatar
Join Date: Dec 2018
Posts: 28
Reputation: 0
Default Need help please

CMDdwarn(playerid, params[])
return SendClientMessage(playerid, COLOR_GREY, "You can't use this command as you aren't apart of law enforcement.");
return cmd_me(playerid, "Freeze! San Andreas Police Department! Put your hands where i can see them now! ((/handsup))");
return 1;
It shows this error
gamemode-jason.pwn(57090) : warning 225: unreachable code
PopularTech is offline   Reply With Quote
Old 26/10/2019, 11:55 PM   #2
MP2's Avatar
Join Date: Jan 2011
Location: England
Posts: 6,234
Reputation: 1004
Default Re: Need help please

The return keyword halts the execution of the function. You have three return statements. Two of them are in an if/else condition so one of them is guaranteed to be called. This means the third one at the bottom will never happen - hence unreachable code.

Remove the first two return statements and just return 1 at the bottom.
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT. The time now is 03:29 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.