SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 16/01/2020, 03:14 PM   #1
Eyex
Little Clucker
 
Join Date: May 2019
Posts: 16
Reputation: 0
Default Undefined String Error Please Help!

Thiy is my code.

//Autoszerelohoz
for(new x;x<sizeof(MechVehicles);x++) {
format(string, sizeof(string), "MECHANIC %d", MechVehicles[x]);
SetVehicleNumberPlate(MechVehicles[x], string);
SetVehicleToRespawn(MechVehicles[x]);
}

Code:
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(653) : error 017: undefined symbol "string"
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(653) : error 017: undefined symbol "string"
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(653) : error 029: invalid expression, assumed zero
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(653) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Please help
Eyex is offline   Reply With Quote
Old 16/01/2020, 03:44 PM   #2
Radless
Little Clucker
 
Join Date: Jul 2019
Posts: 43
Reputation: 3
Default Re: Undefined String Error Please Help!

new string[128];
for(new x;x<sizeof(MechVehicles);x++) {
format(string, sizeof(string), "MECHANIC %d", MechVehicles[x]);
SetVehicleNumberPlate(MechVehicles[x], string);
SetVehicleToRespawn(MechVehicles[x]);
}
Radless is offline   Reply With Quote
Old 16/01/2020, 03:44 PM   #3
Yasef99
Little Clucker
 
Join Date: Jun 2017
Posts: 30
Reputation: 0
Default Re: Undefined String Error Please Help!

//Autoszerelohoz
for(new x;x<sizeof(MechVehicles);x++) {
new string[124]; //Change the Size(124)
format(string, sizeof(string), "MECHANIC %d", MechVehicles[x]);
SetVehicleNumberPlate(MechVehicles[x], string);
SetVehicleToRespawn(MechVehicles[x]);
}
Yasef99 is offline   Reply With Quote
Old 16/01/2020, 03:48 PM   #4
Eyex
Little Clucker
 
Join Date: May 2019
Posts: 16
Reputation: 0
Default Re: Undefined String Error Please Help!

Quote:
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : error 017: undefined symbol "string"
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : warning 215: expression has no effect
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : error 001: expected token: ";", but found "]"
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : fatal error 107: too many error messages on one line
Now.. :/ im try [128]; [256]; but dont work
Eyex is offline   Reply With Quote
Old 16/01/2020, 03:50 PM   #5
Eyex
Little Clucker
 
Join Date: May 2019
Posts: 16
Reputation: 0
Default Re: Undefined String Error Please Help!

Quote:
for(new x;x<sizeof(MechVehicles);x++){
new string[124];
format(string; sizeof(string), "MECHANIC %d", MechVehicles[x]);
SetVehicleNumberPlate(MechVehicles[x],);
SetVehicleToRespawn(MechVehicles[x]);
}
Quote:
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : error 001: expected token: ",", but found ";"
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : warning 215: expression has no effect
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : warning 215: expression has no effect
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : warning 215: expression has no effect
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : error 001: expected token: ";", but found ")"
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : error 029: invalid expression, assumed zero
C:\Users\Eyex\Desktop\NA-RP\gamemodes\rcrp.pwn(656) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Do I need to define String at the beginning of the mode?
Eyex is offline   Reply With Quote
Old 16/01/2020, 05:26 PM   #6
Yasef99
Little Clucker
 
Join Date: Jun 2017
Posts: 30
Reputation: 0
Default Re: Undefined String Error Please Help!

for(new x;x<sizeof(MechVehicles);x++){
new string[124];
format(string, sizeof(string), "MECHANIC %d", MechVehicles[x]); //You put "format(string; sizeof....." is string, sizeof...
SetVehicleNumberPlate(MechVehicles[x],);
SetVehicleToRespawn(MechVehicles[x]);
}
Yasef99 is offline   Reply With Quote
Old 16/01/2020, 08:04 PM   #7
SiaReyes
Gangsta
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 619
Reputation: 57
Default Re: Undefined String Error Please Help!

declare the:
Code:
 new string[124];
outside the loop
SiaReyes 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
error 017: undefined symbol "string" mertcan123 Scripting Help 1 30/08/2017 10:58 AM
[HELP] Fix Error 017: Undefined Sysmbol"string" Elanggg Scripting Help 7 27/04/2014 09:00 AM
error 017: undefined symbol "string" vn007322815 Scripting Help 5 28/12/2013 07:35 AM
error 017: undefined symbol "string" MoNsTeR_EnErGy Scripting Help 4 10/09/2012 10:17 AM
Error 017: undefined symbol "string" MrSnapp Scripting Help 5 24/08/2012 11:19 AM


All times are GMT. The time now is 04:30 AM.


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