SA-MP Forums Archive
Need a bit help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need a bit help (/showthread.php?tid=115307)



Need a bit help - _Sami_ - 23.12.2009

Код:
	if(strcmp(cmd, "/mystats", true) == 0)
	{
    if(logged[playerid] == 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You cannot use commands because you are not logged in.");
    else
    if(logged[playerid] == -2) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You cannot use commands because you are jailed.");
    else
	  format(string, sizeof(string), "Level: %d", dini_Int(udb_encode(playername), "adminlevel");
		SendClientMessage(playerid, COLOR_WHITE, string);
  return 1;
  }
It giving these errors ?
Код:
C:\Documents and Settings\Administrator\Desktop\gamemodes\lvdm.pwn(2475) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
i tried my best but wasnt able to solve this bugs


Re: Need a bit help - _Sami_ - 23.12.2009

no one ?


Re: Need a bit help - MadeMan - 23.12.2009

Try this. (Added brackets for else)

pawn Код:
if(strcmp(cmd, "/mystats", true) == 0)
    {
    if(logged[playerid] == 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You cannot use commands because you are not logged in.");
    else
    if(logged[playerid] == -2) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You cannot use commands because you are jailed.");
    else
    {
        format(string, sizeof(string), "Level: %d", dini_Int(udb_encode(playername), "adminlevel");
        SendClientMessage(playerid, COLOR_WHITE, string);

        format(string, sizeof(string), "Kills: %d", dini_Int(udb_encode(playername), "kills");
        SendClientMessage(playerid, COLOR_WHITE, string);

        format(string, sizeof(string), "Deaths: %d", dini_Int(udb_encode(playername), "deaths");
        SendClientMessage(playerid, COLOR_WHITE, string);
    }



Re: Need a bit help - Gamer_Z - 23.12.2009

pawn Код:
new tmp[256],string[128];
tmp = dini_IntGet(udb_encode(PlayerName(playerid)), "whatuwant1");
format(string,128,"whatuwant1: %d",tmp);
SendClientMessage(playerid,color,string);
tmp = dini_IntGet(udb_encode(PlayerName(playerid)), "whatuwant2");
format(string,128,"whatuwant2: %d",tmp);
SendClientMessage(playerid,color,string);

stock dini_IntGet(filename[],slot[]){
    new tmp[256],value;
    tmp = dini_Get(filename, slot);
    value = strval(tmp);
    return value;
}
understood? :P


Re: Need a bit help - MadeMan - 23.12.2009

I just noticed you got some brackets missing

pawn Код:
if(strcmp(cmd, "/mystats", true) == 0)
    {
    if(logged[playerid] == 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You cannot use commands because you are not logged in.");
    else
    if(logged[playerid] == -2) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You cannot use commands because you are jailed.");
    else
    {
        format(string, sizeof(string), "Level: %d", dini_Int(udb_encode(playername), "adminlevel")); // Here
        SendClientMessage(playerid, COLOR_WHITE, string);

        format(string, sizeof(string), "Kills: %d", dini_Int(udb_encode(playername), "kills")); // Here
        SendClientMessage(playerid, COLOR_WHITE, string);

        format(string, sizeof(string), "Deaths: %d", dini_Int(udb_encode(playername), "deaths")); // Here
        SendClientMessage(playerid, COLOR_WHITE, string);
    }



Re: Need a bit help - _Sami_ - 23.12.2009

Quote:
Originally Posted by MadeMan
I just noticed you got some brackets missing

pawn Код:
if(strcmp(cmd, "/mystats", true) == 0)
    {
    if(logged[playerid] == 0) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You cannot use commands because you are not logged in.");
    else
    if(logged[playerid] == -2) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You cannot use commands because you are jailed.");
    else
    {
        format(string, sizeof(string), "Level: %d", dini_Int(udb_encode(playername), "adminlevel")); // Here
        SendClientMessage(playerid, COLOR_WHITE, string);

        format(string, sizeof(string), "Kills: %d", dini_Int(udb_encode(playername), "kills")); // Here
        SendClientMessage(playerid, COLOR_WHITE, string);

        format(string, sizeof(string), "Deaths: %d", dini_Int(udb_encode(playername), "deaths")); // Here
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
thanks it worked


Re: Need a bit help - _Sami_ - 23.12.2009

stuck in this point

pawn Код:
new killer = dini_Int(udb_encode(playername),("kills"));
    dini_Set(playername, "killer++", kills);//this giving me an error
Код:
C:\Documents and Settings\Administrator\Desktop\gamemodes\lvdm.pwn(4003) : warning 204: symbol is assigned a value that is never used: "killer"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.



Re: Need a bit help - MadeMan - 23.12.2009

pawn Код:
dini_Set(playername, "killer++", kills);
I think it should be like this

pawn Код:
dini_Set(playername, "kills", killer++);



Re: Need a bit help - _Sami_ - 23.12.2009

Код:
C:\Documents and Settings\Administrator\Desktop\gamemodes\lvdm.pwn(4004) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Need a bit help - Dark_Kostas - 23.12.2009

Quote:
Originally Posted by Sami_
pawn Код:
new killer = dini_Int(udb_encode(playername),("kills"));
    dini_Set(playername, "killer++", kills);//this giving me an error
You need to change here the killer with the Killer ID. its usually "killerid" without quotes.