Question about a problem with a simple /setlevel command I made - 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: Question about a problem with a simple /setlevel command I made (
/showthread.php?tid=484837)
Question about a problem with a simple /setlevel command I made -
K9IsGodly - 01.01.2014
(First off, I'm new with scripting pawn so this might be a really easy fix, but I don't know) So I have an issue with my command. Basically the score is the character's level. I made a command called /setlevel that sets the users level up one. However, whenever I use /setlevel it won't go beyond one because I think it's setting the value to only 1. How can I fix this? I'll give the pawn code:
Код:
CMD:setlevel(playerid, params[])
{
new playerlevel=0;
playerlevel++;
SetPlayerScore(playerid, playerlevel);
SendClientMessage(playerid, COLOR_RED, "Your level has been set!");
return 1;
}
Re: Question about a problem with a simple /setlevel command I made -
SilentSoul - 01.01.2014
You can simply use something like that.
pawn Код:
CMD:setlevel(playerid,params[])
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+1); //getting the current player score and increase the value +1 , no need for all codes above.
SendClientMessage(playerid, COLOR_RED, "Your level has been set!");
return 1;
}
Sources :
https://sampwiki.blast.hk/wiki/SetPlayerScore
https://sampwiki.blast.hk/wiki/GetPlayerScore
Re: Question about a problem with a simple /setlevel command I made -
K9IsGodly - 01.01.2014
Quote:
Originally Posted by SilentSoul
|
Thanks that worked quite well for me. I didn't even know I could do something like that.