SA-MP Forums Archive
Need 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)
+--- Thread: Need help (/showthread.php?tid=346994)



Need help - JustinAn - 30.05.2012

Hey guys, I need help, first I have a error saying this.

pawn Код:
C:\Users\Michael\Desktop\samp03e_svr_win32\gamemodes\test.pwn(2009) : warning 204: symbol is assigned a value that is never used: "cash"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Line 2009 is this code:

pawn Код:
new cash = PlayerInfo[playerid][pCash];
I don't get this problem, I need help. Didn't I do it correctly?


Full Code
pawn Код:
CMD:stats(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new cash = PlayerInfo[playerid][pCash];
        new level = GetPlayerScore(playerid);
        new name[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME];
        SendClientMessage(playerid, COLOR_LIME, "_______________________________________________");
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[Account]: Name: [%s] Level: [%i]",name, level);
        SendClientMessage(playerid, COLOR_GRAD2, string);
    }
    return 1;
}



Re: Need help - rVar - 30.05.2012

Delete that line.

"new cash = PlayerInfo[playerid][pCash];" from command, you don't use that function in it.


Re: Need help - FalconX - 30.05.2012

pawn Код:
CMD:stats( playerid, params[ ] )
{
    if( IsPlayerConnected( playerid ) )
    {
        new cash = PlayerInfo[ playerid ][ pCash ];
        new level = GetPlayerScore( playerid );
        new name[ MAX_PLAYER_NAME ], string[ MAX_PLAYER_NAME ];
        SendClientMessage( playerid, COLOR_LIME, "_______________" );
        GetPlayerName( playerid, name, sizeof( name ) );
        format( string, sizeof( string ), "[Account]: Name: [%s] Level: [%i] Cash: %d",name, level, cash ); //use cash here as well.
        SendClientMessage( playerid, COLOR_GRAD2, string );
    }
    return 1;
}
You can use it and if you don't want you can remove it.


Re: Need help - Edward156 - 30.05.2012

You created a new variable named "cash" two times. Just replace
pawn Код:
CMD:stats(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new cash = PlayerInfo[playerid][pCash];
        new level = GetPlayerScore(playerid);
        new name[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME];
        SendClientMessage(playerid, COLOR_LIME, "_______________________________________________");
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[Account]: Name: [%s] Level: [%i]",name, level);
        SendClientMessage(playerid, COLOR_GRAD2, string);
    }
    return 1;
}
with this:
pawn Код:
CMD:stats(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new level = GetPlayerScore(playerid);
        new name[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME];
        SendClientMessage(playerid, COLOR_LIME, "_______________________________________________");
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[Account]: Name: [%s] Level: [%i]",name, level);
        SendClientMessage(playerid, COLOR_GRAD2, string);
    }
    return 1;
}