SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 05/08/2012, 11:29 AM   #11
Universal
Huge Clucker
 
Universal's Avatar
 
Join Date: Jan 2010
Posts: 484
Reputation: 27
Default Re: All of your stupid embarrassing coding mistakes!

You are not the only one, who has these stupid little mistakes. This is one of my mistakes that I usually make:
pawn Code:
for(new i=0; i<MAX_PLAYERS; i++) {
   if(IsPlayerConnected(playerid)) {
      // ...
   }
}
I always forget that its not playerid I should use inside the loop.

And for the things you want to remember, I make a to-do list above everything in the main .pwn file (ofc. its commented) and I always track this list so I can remember what I have done and what needs to be done.
Universal is offline   Reply With Quote
Old 05/08/2012, 11:53 AM   #12
IstuntmanI
High-roller
 
IstuntmanI's Avatar
 
Join Date: Mar 2009
Location: Romania
Posts: 1,699
Reputation: 231
Default Re: All of your stupid embarrassing coding mistakes!

Quote:
Originally Posted by [HLF]Southclaw View Post
If you see my posts, you probably know I make a ton of stupid mistakes, then I fix them, right after posting.
^ This. I request help, then I fix/solve (almost everytime) it myself.
__________________


IstuntmanI is offline   Reply With Quote
Old 05/08/2012, 11:57 AM   #13
Basssiiie
High-roller
 
Basssiiie's Avatar
 
Join Date: Mar 2011
Location: The Netherlands
Posts: 1,011
Reputation: 183
Default Re: All of your stupid embarrassing coding mistakes!

One I usually make:
Code:
stock Something(playerid);
{
	// something here
}
There shouldn't be a ; on the after Something(playerid)..
Basssiiie is offline   Reply With Quote
Old 05/08/2012, 11:59 AM   #14
Jikesh
Big Clucker
 
Jikesh's Avatar
 
Join Date: Jun 2009
Posts: 185
Reputation: 26
Default Re: All of your stupid embarrassing coding mistakes!

Happens with me most of the time
Code:
SendClientMessageToAll(playerid, -1, string);
Jikesh is offline   Reply With Quote
Old 05/08/2012, 12:14 PM   #15
playbox12
High-roller
 
playbox12's Avatar
 
Join Date: Feb 2010
Location: Netherlands
Posts: 1,640
Reputation: 216
Default Re: All of your stupid embarrassing coding mistakes!

Using cache functions while having cache disabled for the query.
playbox12 is offline   Reply With Quote
Old 05/08/2012, 10:30 PM   #16
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,511
Reputation: 1057
Default Re: All of your stupid embarrassing coding mistakes!

Okay, I just fixed a DAMN ANNOYING (but incredibly newbie stupid) bug.

I spent about 2 hours this morning trying to work out why file loaded vehicles weren't spawning or their coordinates weren't working in IsPointInDynamicArea.

Forgot 'Float:' on coordinate variables.



[HLF]Southclaw is online now   Reply With Quote
Old 05/08/2012, 10:48 PM   #17
Joe Staff
High-roller
 
Joe Staff's Avatar
 
Join Date: Aug 2007
Posts: 2,812
Reputation: 330
Default Re: All of your stupid embarrassing coding mistakes!

Quote:
Originally Posted by [HLF]Southclaw View Post
Okay, I just fixed a DAMN ANNOYING (but incredibly newbie stupid) bug.

I spent about 2 hours this morning trying to work out why file loaded vehicles weren't spawning or their coordinates weren't working in IsPointInDynamicArea.

Forgot 'Float:' on coordinate variables.



I get these kinds of errors when working with Java (Android OS) and kind of relating to issues I have when working with angles. Not sure if I should use radians or Euler in some maths.
__________________
Evil triumphs when good men do nothing.
Joe Staff is offline   Reply With Quote
Old 06/08/2012, 12:27 AM   #18
Jstylezzz
High-roller
 
Jstylezzz's Avatar
 
Join Date: Sep 2011
Location: the Netherlands
Posts: 1,744
Reputation: 905
Red face Re: All of your stupid embarrassing coding mistakes!

i make those stupid mistakes like
pawn Code:
if(!IsPlayerInAnyVehicle(playerid,COLOR_RED,"You are not in any car"));
which has to be:
pawn Code:
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not in any car");

i know, this is pretty stupid
__________________
Tired of all those power hungry roleplay servers nowadays, running one of those annoying edits? I'm working on a script completely from scratch! This isn't just a "roleplay" server, this is "life simulation", at least that's the concept.
The server will be based in Palomino Creek. If you're interested and want to help us to get the forum going, why not register and join the conversation? We're also more than happy to accept suggestions from anyone. Hope to see you soon!
  • Want to follow my progress of making a detailed KITT replica? (last update 7/Aug/14) - Click
  • Living in the Countryside forum - Click me
  • Need a script done? Go here (Scripts for release on this forum are free!)
Jstylezzz is offline   Reply With Quote
Old 06/08/2012, 12:31 AM   #19
admantis
High-roller
 
admantis's Avatar
 
Join Date: Sep 2009
Posts: 2,290
Reputation: 242
Default Re: All of your stupid embarrassing coding mistakes!

I always confuse variables in loops, like this:

pawn Code:
foreach(Player, i)
{
SendClientMessage(playerid, -1, "Some text");
}
And the player would be spammed with that text.
It really happens in an almost daily basis.
admantis is offline   Reply With Quote
Old 13/08/2012, 03:24 AM   #20
NinjaChicken
Huge Clucker
 
Join Date: Dec 2011
Posts: 424
Reputation: 10
Default Re: All of your stupid embarrassing coding mistakes!

i accidently created a loop, so that every 10 seconds the players cars got duped, so in about 10 minutes the server over loaded because i broke samp limits it was quite diffcult to fix as every player had about 800 cars each spawning on the same spot... caused alot of lag
NinjaChicken is offline   Reply With Quote
Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding mistakes Y_Less Scripting Help 8 03/10/2011 04:45 PM
Embarrassing (CreateObject) Unknown123 Help Archive 6 18/02/2011 04:41 PM
Issue involving a warning i cannot resolve (Embarrassing) Armed2 Help Archive 4 29/01/2011 07:35 AM
This is kinda embarrassing(Class Request Issue) Souvlaki Help Archive 11 25/08/2010 07:10 PM
stupid nooby question from a stupid noob ;) Packer5 Help Archive 7 02/11/2009 09:32 PM


All times are GMT. The time now is 08:12 AM.


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