Some errors with new functions
#1

I'm tryng to make a new set of natives for my rp script wich will define noobs from normal players, hackers and others i just can't get right the strings and other functions i tryed 10 times in all the ways i know but as i am a bit of new in the domain of scripting i still can't get some things right!
This is the Error
Код:
C:\Users\DjAdy\Desktop\wtf?\gamemodes\RP2.pwn(474) : error 010: invalid function or declaration
C:\Users\DjAdy\Desktop\wtf?\gamemodes\RP2.pwn(474 -- 483) : error 010: invalid function or declaration
C:\Users\DjAdy\Desktop\wtf?\gamemodes\RP2.pwn(474 -- 484) : error 010: invalid function or declaration
C:\Users\DjAdy\Desktop\wtf?\gamemodes\RP2.pwn(474 -- 484) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
And this is the hole code!
Код:
stock SetPlayerNoobLevel( playerid , level )
{
  ResetPlayerNoobLevel(playerid);
  return GivePlayerNoobLevel(playerid, level);
}
stock ResetPlayerNoobLevel( playerid)
{
new level;
 for (new i = 100, s = strlen(level); i < s: i--)
 {
  if(level[i] > '100' || level[i] < '0')
 }
}
stockGetPlayerNoobLevel(playerid)
{
 new level;
 for (new i = 100, d = strlen(level); i = s: i=)
 {
 if(level[i] = '100' || level[i] < '0')
 }
 if(GetPlayerNoobLevel(playerid) == 100)
 {
 FormMessageForAll(playerid,"%s is a Mega Noob with level %d",GetPlayerName( playerid ), GetPlayerNoobLevel( playerid ));
 return 1;
 }
}
stock GivePlayerNoobLevel(playerid, level)
{
 SetPlayerScore(playerid, -100);
 if(GetPlayerScore(playerid) == -100)
 {
 if(nvar == 0)
 {
 Attach3DTextLabelToPlayer(Text3D:megan, playerid, 45,23,13);
 return 1;
 }
 else if(nvar == 1)
 {
 Send("Already a Mega Noob)
 return 1;
 }
 }
}
PS:what you see above is my atempt to mimic the getplayerdrunklevel,setplayerdrunklevel etc, altrough none copied from the originial inc for sa-mp . please help me cuz i can't make this shit work
Lines of error are one from getplayernooblevel
Reply
#2

which is lines with errors
Reply
#3

stock GetPlayerNoobLevel(playerid)
{
new level;
for (new i = 100, d = strlen(level); i = s: i=)
{
if(level[i] = '100' || level[i] < '0')
}
if(GetPlayerNoobLevel(playerid) == 100)
{
FormMessageForAll(playerid,"%s is a Mega Noob with level %d",GetPlayerName( playerid ), GetPlayerNoobLevel( playerid ));
return 1;
}
}
errors are on this line!
Reply
#4

got it down to 2 errors
stock GetPlayerNoobLevel(playerid)
{
new level;
for (new i = 100, d = strlen(level); i = s: i=)
{
if(level[i] = '100' || level[i] < '0')
}
if(GetPlayerNoobLevel(playerid) == 100)
{
SendClientMessageToAll(playerid,"%s is a Mega Noob with level %d",GetPlayerName( playerid ), GetPlayerNoobLevel( playerid ));
return 1;
}
}
Reply
#5

'level' is an integer, not a string. Hence why it doesn't work
Reply
#6

and how should i make it work properly?cuz i don't really know what to do it is my first attempt to make something like this
Reply
#7

Try changing strlen(level) to Strval(level) (https://sampwiki.blast.hk/wiki/Strval).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)