SA-MP Forums Archive
Problem with '?'. - 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: Problem with '?'. (/showthread.php?tid=599803)



Problem with '?'. - norton2 - 30.01.2016

I receive many errors, the code is in a loop.

Код HTML:
if(IsPlayerConnected(ReturnUser(name)) ? (format(str, sizeof(str), "Online.")) : (format(str, sizeof(str), "Offline.")))
Код HTML:
undefined symbol "FormatNumber"
undefined symbol "FormatNumber"
undefined symbol "GiveMoney"
...etc



Re: Problem with '?'. - BiosMarcel - 30.01.2016

first of all, you shouldnt use format like that, use str = "Offline." and str = "Online."
You should only use format if there is anythign that u want to put into the string like another variable.
And also you should give us your errors, that would be helpful


Re: Problem with '?'. - BiosMarcel - 30.01.2016

so it seems like you are trying to use non existant functions?


Re: Problem with '?'. - Prostilov - 30.01.2016

The errors you showed have nothing to do with the line of code that you've put on here. Show us the lines where the errors occur, you might have mistyped the function or you forgot a bracket (assuming that you even have the function defined).


Re: Problem with '?'. - norton2 - 30.01.2016

Код HTML:
for(new i = 0; i < cache_num_rows(); i++)
{
    if(IsPlayerConnected(ReturnUser(name)) ? (format(str, sizeof(str), "%s", name)) : (format(str, sizeof(str), "%d", rank)))
}
Receive many errors:
Код HTML:
\include\sscanf2.inc(149) : warning 219: local variable "i" shadows a variable at a preceding level
\include\sscanf2.inc(193) : warning 219: local variable "i" shadows a variable at a preceding level
\include\mSelection.inc(656) : warning 219: local variable "i" shadows a variable at a preceding level
\GM.pwn(1657) : warning 219: local variable "i" shadows a variable at a preceding level
\GM.pwn(1791) : error 017: undefined symbol "GetPlayerSpeed"
\GM.pwn(1785) : error 017: undefined symbol "GetName"
.........and so on.........
If I remove the line:
Код HTML:
if(IsPlayerConnected(ReturnUser(name)) ? (format(str, sizeof(str), "%s", name)) : (format(str, sizeof(str), "%d", rank)))
everything works correctly.


Re: Problem with '?'. - Prostilov - 30.01.2016

In which function are you running these?


Re: Problem with '?'. - BiosMarcel - 30.01.2016

PHP код:
if(IsPlayerConnected(ReturnUser(name)) ? (format(strsizeof(str), "%s"name)) : (format(strsizeof(str), "%d"rank)) 
try that


Re: Problem with '?'. - VVWVV - 30.01.2016

Ah dude... What u doing?

My variant:
PHP код:
format(strsizeof strIsPlayerConnected(ReturnUser(name)) ? ("Online.") : ("Offline.")/*, arguments... (if you need)*/); 



Re: Problem with '?'. - norton2 - 30.01.2016

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
PHP код:
if(IsPlayerConnected(ReturnUser(name)) ? (format(strsizeof(str), "%s"name)) : (format(strsizeof(str), "%d"rank)) 
try that
What is the difference?
Not work.


Re: Problem with '?'. - norton2 - 30.01.2016

Quote:
Originally Posted by VVWVV
Посмотреть сообщение
Ah dude... What u doing?

My variant:
PHP код:
format(strsizeof strIsPlayerConnected(ReturnUser(name) ? ("Online.") : ("Offline.")); 
Not work.
Код HTML:
\GM.pwn(8403) : error 035: argument type mismatch (argument 1)