/givemoney and /setmoney
#1

Guys im making a /givemonye cmd and /setmoney but now when i try to compile show me this just with my cmd /givemoney

PHP код:
CMD:givemoney(playerid, params[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 4)
    {
        new 
string[128], string2[128], giveplayerid, money;
        if(
sscanf(params, "ud", giveplayerid, money)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givemoney [PlayerID / PartOfName] [Money]");
        if(
IsPlayerConnected(giveplayerid))
        {
            
GivePlayerMoney(giveplayerid, money);
            
format(string, sizeof(string), "You have give player %s's $%d.",GetName(giveplayerid),money);//You have set %s's cash to an amount of $%d.
            
SendClientMessage(playerid, COLOR_SUCCESS, string);
            
format(string2 ,sizeof(string2),"Admin Notification: Administrator %s has given you $%d.", GetName(id), money);
            
SendClientMessage(playerid, COLOR_SUCCESS, string2);
            new 
ip[32], ipex[32];
               new 
i_dateTime[2][3];
            
gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
            
getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);
            
GetPlayerIp(playerid, ip, sizeof(ip));
            
GetPlayerIp(giveplayerid, ipex, sizeof(ipex));
            
format(string, sizeof(string), "[%i/%i/%i - %i:%i:%i] %s (IP:%s) has paid $%d to %s (IP:%s)", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], GetName(playerid), ip, money, GetName(giveplayerid), ipex);
            
PayLog(string);
            
PlayerInfo[playerid][pCash] = money;
        }
    }
    else
    {
        
SendClientMessage(playerid, COLOR_CORRECTION, "You are not authorized to use that command !");
    }
    return 
1;
} 
Код HTML:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1766) : error 017: undefined symbol "id"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
line 1766

PHP код:
format(string2 ,sizeof(string2),"Admin Notification: Administrator %s has given you $%d.", GetName(id), money); 
Reply
#2

Код:
format(string2 ,sizeof(string2),"Admin Notification: Administrator %s has given you $%d.", GetName(giveplayerid), money);
Reply
#3

Do you have a stock GetName anywhere in your script?If you don't then put this anywhere you want.
Код:
stock GetName(playerid)
{
new getthename[MAX_PLAYER_NAME];
GetPlayerName(playerid,getthename,sizeof(getthename));
return getthename;
}
Reply
#4

Quote:
Originally Posted by Mike861
Посмотреть сообщение
Do you have a stock GetName anywhere in your script?If you don't then put this anywhere you want.
Код:
stock GetName(playerid)
{
new getthename[MAX_PLAYER_NAME];
GetPlayerName(playerid,getthename,sizeof(getthename));
return getthename;
}
There are no problem with that.
Reply
#5

Quote:
Originally Posted by Mike861
Посмотреть сообщение
Do you have a stock GetName anywhere in your script?If you don't then put this anywhere you want.
Код:
stock GetName(playerid)
{
new getthename[MAX_PLAYER_NAME];
GetPlayerName(playerid,getthename,sizeof(getthename));
return getthename;
}
i already have it
Reply
#6

Quote:
Originally Posted by Jaua10
Посмотреть сообщение
i already have it
Have you try my code?
Reply
#7

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
Have you try my code?
yes, it works but now im having 1 error and 1 warning with this:

PHP код:
CMD:setmoney ( playerid , params [] )
{
    if ( !
PlayerInfo[playerid][pAdmin] >= 4 ) return NotAdmin(playerid);
    new 
id , ammount;
    if ( !
IsPlayerConnected ( id ) ) return SendClientMessage ( playerid , COLOR_CORRECTION , "Invalid player specified !" ) ;
    if ( 
ammount < 0 || ammount > 900000000 ) return SendClientMessage ( playerid , -1 , "You can't set more than $900.000.000" ) ;
    if ( 
GetPlayerMoney ( playerid ) < ammount ) return SendClientMessage ( playerid , -1 , "You cant give money more than you have." ) ;
    if ( 
sscanf ( params , "ui" , id , ammount ) ) return SendClientMessage ( playerid , -1 , "USAGE : /setmoney [PlayerID / PartOfName] [Ammount]" ) ;
    else
    {
    new 
IName [ MAX_PLAYER_NAME ] , PName [ MAX_PLAYER_NAME ] , Str [ 128 ] ;
    
GetPlayerName ( id , IName , MAX_PLAYER_NAME ) ;
    
GetPlayerName ( playerid , IName , MAX_PLAYER_NAME ) ;
    
format ( Str , 128 , "%s Has Given You %d" , IName , ammount ) ;
    
SendClientMessage ( id , COLOR_RED , Str ) ;
    
format ( Str , 128 , "You Gave %d Money To %s" , ammount , PName ) ;
    
SendClientMessage ( playerid , COLOR_GREEN , Str ) ;
    
GivePlayerMoney ( id , ammount ) ;
    }
    return 
1;
} 
Код HTML:
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1788) : warning 213: tag mismatch
C:\Users\Jaua\Downloads\samp037_svr_R2-1-1_win32\gamemodes\baserp.pwn(1788) : error 017: undefined symbol "NotAdmin"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
line error

Код HTML:
if ( !PlayerInfo[playerid][pAdmin] >= 4 ) return NotAdmin(playerid);
Reply
#8

It's possible to make it more easy? like this i found on tutorial, but i havent seen the admin params

Код:
CMD:setmoney(playerid, params[])
{
	new target;
	new money;
	if(sscanf(params, "ui", target, money)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setmoney [playerid] [amount]");
	{
        ResetPlayerMoney(target);
		GivePlayerMoney(target, money);
		return 1;
	}
}
Reply
#9

It seems that you are copying the code from somewhere right?

Change NotAdmin to return 0; or SendClientMessage
Reply
#10

Код:
CMD:setmoney ( playerid , params [] )
{
    if ( !PlayerInfo[playerid][pAdmin] >= 4 ) return SendClientMessage (playerid , COLOR_CORRECTION , "You are not admin!" ) ;
    new id , ammount;
    if ( !IsPlayerConnected ( id ) ) return SendClientMessage ( playerid , COLOR_CORRECTION , "Invalid player specified !" ) ;
    if ( ammount < 0 || ammount > 900000000 ) return SendClientMessage ( playerid , -1 , "You can't set more than $900.000.000" ) ;
    if ( GetPlayerMoney ( playerid ) < ammount ) return SendClientMessage ( playerid , -1 , "You cant give money more than you have." ) ;
    if ( sscanf ( params , "ui" , id , ammount ) ) return SendClientMessage ( playerid , -1 , "USAGE : /setmoney [PlayerID / PartOfName] [Ammount]" ) ;
    else
    {
    new IName [ MAX_PLAYER_NAME ] , PName [ MAX_PLAYER_NAME ] , Str [ 128 ] ;
    GetPlayerName ( id , IName , MAX_PLAYER_NAME ) ;
    GetPlayerName ( playerid , IName , MAX_PLAYER_NAME ) ;
    format ( Str , 128 , "%s Has Given You %d" , IName , ammount ) ;
    SendClientMessage ( id , COLOR_RED , Str ) ;
    format ( Str , 128 , "You Gave %d Money To %s" , ammount , PName ) ;
    SendClientMessage ( playerid , COLOR_GREEN , Str ) ;
    GivePlayerMoney ( id , ammount ) ;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)