|
|
#1 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Feb 2010
Location: 52.511938,6.092434 find it.
Posts: 446
Reputation: 20
|
Hey, I'm trying to create a script that when a player passes a police with his car, and going over 130. It gives an +1 star and the police and SRT are getting informed about it.
The script so far: pawn Code:
The errors: Code:
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(214) : error 055: start of function body without function header
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(217) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(218) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(221) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(223) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(225) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(227) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(230) : error 054: unmatched closing brace ("}")
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(231) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(233) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(235) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(239) : error 010: invalid function or declaration
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(242) : error 025: function heading differs from prototype
Someone can help me out? Thanks in advance! -Kevin |
|
|
|
|
|
#2 |
|
Gangsta
![]() ![]() ![]() ![]() Join Date: Jul 2011
Posts: 920
Reputation: 338
|
Can you explain what's this:
pawn Code:
You only need one loop there. And replace i with playerid in the rest of the loop. Additionally I can spot a lot of parts which could be shortened and by that, improved a little efficiency-wise. pawn Code:
pawn Code:
Also look at this: pawn Code:
This could be improved to: pawn Code:
|
|
|
|
|
|
#3 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Feb 2010
Location: 52.511938,6.092434 find it.
Posts: 446
Reputation: 20
|
playerid would be only for the police, and the i is for if someone is passing by the police.
I thought it was wrong but how do I make it for 2 classes that they won't get caught? |
|
|
|
|
|
#4 |
|
Gangsta
![]() ![]() ![]() ![]() Join Date: Jul 2011
Posts: 920
Reputation: 338
|
Oh, sorry for the confusement. But your code itself is quite confusing as well.
What it should be like is: 1. Start the first loop 2. Check if the looped player is firstly in the group that can be punished for speeding and check if they are speeding (going over 130). 3. If the player is speeding, get the speed of the speeding player and loop through all police officers 4. If the police officer is within the range of the speeder, report the player as the speeder Your code at the current moment confuses me. |
|
|
|
|
|
#5 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Feb 2010
Location: 52.511938,6.092434 find it.
Posts: 446
Reputation: 20
|
Code:
C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(214) : error 055: start of function body without function header C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(217) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(219) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(221) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(223) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(225) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(227) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(231) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(234) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(236) : error 021: symbol already defined: "SetPlayerWantedLevel" C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(238) : error 021: symbol already defined: "SendClientMessage" C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(241) : error 021: symbol already defined: "GetPlayerName" C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(243) : error 021: symbol already defined: "format" C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(244) : error 021: symbol already defined: "Police_SendMessage" C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(245) : error 021: symbol already defined: "SRT_SendMessage" C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(247) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(250) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(253) : error 010: invalid function or declaration C:\Users\Barbara\Desktop\SAMP Kevin\hoi\gamemodes\PPC_Trucking.pwn(257) : error 010: invalid function or declaration pawn Code:
You meant it like that? |
|
|
|
|
|
#6 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Belgium
Posts: 4,902
Reputation: 1423
|
pawn Code:
|
|
|
|
|
|
#7 |
|
Gangsta
![]() ![]() ![]() ![]() Join Date: Jul 2011
Posts: 920
Reputation: 338
|
What seems to be generating some errors is the semi-colon after the public header.
pawn Code:
Also, I see you're returning 0 in various places. Why is this? Seems unnecessary to me. You can also combine 2 if-checks, these: pawn Code:
pawn Code:
pawn Code:
Continuing further down in your code, I see this: pawn Code:
1. Get the position of the police officer (one GetPlayerPos per police officer) 2. See if the player is near the police officer (one IsPlayerInRangeOfPoint per police officer) What you could do is: 1. Get the position of the speeding player (ONCE!!!) 2. See if the police officer is near the speeding player (one IsPlayerInRangeOfPoint per police officer). This way things would be much more efficient. pawn Code:
Once you post the new errors and your questions, I can continue helping you! |
|
|
|
|
|
#8 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Feb 2010
Location: 52.511938,6.092434 find it.
Posts: 446
Reputation: 20
|
I'm having some trouble understanding the last part you posted, maybe if you are in for it, you can help me via teamviewer. Contact me on skype: kevinnie31
|
|
|
|
|
|
#9 |
|
Gangsta
![]() ![]() ![]() ![]() Join Date: Jul 2011
Posts: 920
Reputation: 338
|
I am on vacation and I don't have such tools on my laptop. And I don't see what's so complicated. Read what I said through a few more times and try to understand how loops work.
Then go and simply replace the inner loop (looping through i) with the code that I posted. Copying and pasting is a hassle for me right now so I'll leave you the task of doing that yourself. |
|
|
|
|
|
#10 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Feb 2010
Location: 52.511938,6.092434 find it.
Posts: 446
Reputation: 20
|
I'll look on it tonight, thanks! Keep in touch!
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| check for player pos (+rep) | WardenCS | Scripting Help | 7 | 09/04/2012 07:25 PM |
| /enter that brings you in the car if in a car, or on foot if on foot. | Garc1a | Help Archive | 2 | 16/09/2010 06:23 PM |
| [HELP] IS PLAYER ON FOOT COMMAND | akis_tze | Help Archive | 2 | 30/12/2009 07:53 PM |
| Need help speeding up my computer? | DeltaAirlines12 | Everything and Nothing | 28 | 24/11/2009 10:51 PM |
| is player on foot | hipy | Help Archive | 5 | 22/06/2009 06:05 PM |