SA-MP Forums Archive
What is wrong in that code Rep+++ - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What is wrong in that code Rep+++ (/showthread.php?tid=335638)



What is wrong in that code Rep+++ - boyan96 - 19.04.2012

PHP код:
if(GetPlayerScore(playerid) > 1)
{
 new 
string[128], pName[MAX_PLAYER_NAME];
 
GetPlayerName(playeridpNamesizeof(pName);
 
format(stringsizeof(string), "{NeWBie}: %s (ID: %d): %s"pNameplayeridtext);
 
SendClientMessageToAll(COLOR_REDstring);
 return 
0;

errors
C:\Users\user\Desktop\gamemode\gamemodes\1.pwn(504 7) : error 001: expected token: ",", but found ":"

Line of Errors
PHP код:
 GetPlayerName(playeridpNamesizeof(pName); 



Re: What is wrong in that code Rep+++ - Bogdan1992 - 19.04.2012

GetPlayerName(playerid, pName, sizeof(pName)); You forgot the other ")"


Re: What is wrong in that code Rep+++ - Biesmen - 19.04.2012

You didn't close the bracket thing..
pawn Код:
GetPlayerName(playerid, pName, sizeof(pName));
Explanation:
You open GetPlayerName by typing this: GetPlayerName(
Then you open sizeof by typing this: sizeof(
Then you close sizeof by typing this at the end of the sizeof part: )
But you forgot to close GetPlayerName..

Edit: Bogdan was first


Re: What is wrong in that code Rep+++ - RollTi - 19.04.2012

you miss the brakcet ')'

Late


Re: What is wrong in that code Rep+++ - boyan96 - 19.04.2012

C:\Users\user\Desktop\gamemode\gamemodes\1.pwn(514 7) : warning 219: local variable "string" shadows a variable at a preceding level

Code of error
PHP код:
new string[128], pName[MAX_PLAYER_NAME]; 



Re: What is wrong in that code Rep+++ - RollTi - 19.04.2012

there is already string delete

pawn Код:
new string[128];
then just remain this

pawn Код:
new pName[MAX_PLAYER_NAME];



Re: What is wrong in that code Rep+++ - Biesmen - 19.04.2012

You already defined string, remove new string[128] and just keep new pName[MAX_PLAYER_NAME].

Edit: FU at the post above! Aways too late.. Q_Q


Re: What is wrong in that code Rep+++ - boyan96 - 19.04.2012

PHP код:
if(realchat)
    {
 if(
GetPlayerScore(playerid) < 200)
{
 new 
pName[MAX_PLAYER_NAME];
 
GetPlayerName(playeridpNamesizeof(pName));
 
format(stringsizeof(string), "{NeWBie}: %s (ID: %d): %s"pNameplayeridtext);
 
SendClientMessageToAll(COLOR_REDstring);
 return 
0;
}
if(
GetPlayerScore(playerid) < 500)
{
 new 
pName[MAX_PLAYER_NAME];
 
GetPlayerName(playeridpNamesizeof(pName));
 
format(stringsizeof(string), "{RoOkIe}:: %s (ID: %d): %s"pNameplayeridtext);
 
SendClientMessageToAll(COLOR_REDstring);
 return 
0;
}
        return 
0;
    }
    return 
1;

and how i can make is player have less 200 score to show before his nickname {NeWBie}


Re: What is wrong in that code Rep+++ - Biesmen - 19.04.2012

pawn Код:
new pName[MAX_PLAYER_NAME];
 GetPlayerName(playerid, pName, sizeof(pName));
 if(GetPlayerScore(playerid) < 200)
 {
    format(string, sizeof(string), "{NeWBie}: %s (ID: %d): %s", pName, playerid, text);
 }
 else
 {
    format(string, sizeof(string), "{RoOkIe}:: %s (ID: %d): %s", pName, playerid, text);
 }
 SendClientMessageToAll(COLOR_RED, string);
 return 0;



Re: What is wrong in that code Rep+++ - boyan96 - 19.04.2012

this don't work