AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Error Info (https://forums.alliedmods.net/showthread.php?t=185421)

Waleed 05-17-2012 08:05

Error Info
 
Code:

new string[100];
new name[get_user_name(playerid, sizeof(name), strlen(string)];

I am trying to get name of user,But few errors are happening.
Solve the below errors please.


ERRORS:
Error1: Undefined symbol "name" on line 20 //Which name is it talking about,There are two names?
Error2: Invalid expression, assumed zero on line 20 //What to do with this?
Error3: Expected token: ";", but found "]" on line 20 //What is this?

kiki33hun 05-17-2012 08:25

Re: Error Info
 
new name = get_user_name(playerid, sizeof(name), strlen(string);

<VeCo> 05-17-2012 08:31

Re: Error Info
 
You can't use natives like that. This is correct:



PHP Code:

new name[32]
get_user_name(playeridnamecharsmax(name)) 


You need to assign a variable and select where to store the name with given maximum characters.
Charsmax gets the maximum lenght that a string array can contain, it's the same as sizeof(name) - 1 (in this case, that's the same as 31).


Then the player name is stored into the "name" string.

Liverwiz 05-18-2012 13:57

Re: Error Info
 
I didn't want to start a new thread for this question for its so short. This line gives me a "warning" on compile and i'm wondering why....

PHP Code:

#define LVL5 180        // Regular knife  RandomFloat(15, 75
#define LEVEL_INCREMENT 31    // Frags per level (after the defined levels 0-5)
new i_offset LVL5 - (LEVEL_INCREMENT*5

Quote:

Warning: Tag mismatch on line 857
Also....is my math right? for use in....
Code:

new Float:calc =  (g_playerFrags[id] + i_offset) / LEVEL_INCREMENT

<VeCo> 05-18-2012 13:59

Re: Error Info
 
That has nothing to do with this thread. Post a new one and show what LVL5 and LEVEL_INCREMENT are.


All times are GMT -4. The time now is 00:20.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.