How to give levels to everyone? - 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: How to give levels to everyone? (
/showthread.php?tid=641131)
[SOLVED]How to give levels to everyone? -
AmarPlayer - 11.09.2017
I am making a command which when you type in you get a dialog to choose, money or level.
When you choose you have to type in how many levels you want to give to everyone.
For example: If I am at level 3, and an admin does that command, chooses level, types in 5, I get 5 more levels,
I don't want him to set my level to five, but to add that to what I already have.
Here's what I'm trying to do:
Код:
case DIALOG_NAGRADE_LEVEL:
{
if(response)
{
for(new i; i < GetMaxPlayers(); i++)
{
new leveligraca = GetPlayerScore(i);
SetPlayerScore(leveligraca, ++(inputtext));
}
}
}
I get this error:
must be lvalue (non-constant)
How should I do this?
Re: How to give levels to everyone? -
Kane - 11.09.2017
You need to convert inputtext into an integer.
https://sampwiki.blast.hk/wiki/Strval
Example:
PHP код:
new string[4] = "250";
new iValue = strval(string); // iValue is now '250
//In your case:
new ourValue = strval(inputtext);
I assume using the players score as the player ID was a mistake. You just need to add them together.
PHP код:
SetPlayerScore(i, GetPlayerScore(i) + ourValue);
Re: How to give levels to everyone? -
AmarPlayer - 11.09.2017
Thank you man, +rep