CMD Error
#1

Can not give cash to myself.it says that the player is not connected. Plz solve the problem..



CMD:givecash(playerid, params[])
{
//check if the player is a admin
LevelCheck(playerid, 3);

new target, amount;
if(sscanf(params, "ui", target, amount)) return SendClientMessage(playerid, COLOR_THISTLE, "USAGE: /givecash [player] [amount]");

if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_FIREBRICK, "ERROR: The specified player is not conected.");

GivePlayerMoney(target, amount);
PlayerPlaySound(target, 1057, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);

new string[144];
format(string, sizeof(string), "admin %s[%i] has given you money $%i.", ReturnPlayerName(playerid), playerid, amount);
SendClientMessage(target, COLOR_DODGER_BLUE, string);
format(string, sizeof(string), "You have given %s[%i]'s money $%i.", ReturnPlayerName(target), target, amount);
SendClientMessage(playerid, COLOR_DODGER_BLUE, string);
return 1;
}
Reply
#2

Use
PHP код:
[CODE][/CODE
It's hard to see if you don't use it.
Reply
#3

PHP код:
CMD:givecash(playeridparams[])
{
//check if the player is a admin
LevelCheck(playerid3);
new 
targetamount;
if(
sscanf(params"ui"targetamount)) return SendClientMessage(playeridCOLOR_THISTLE"USAGE: /givecash [player] [amount]");
printf("tid = %d pid = %d" ,target,playerid);
if(!
IsPlayerConnected(target)) return SendClientMessage(playeridCOLOR_FIREBRICK"ERROR: The specified player is not conected.");
GivePlayerMoney(targetamount);
PlayerPlaySound(target10570.00.00.0);
PlayerPlaySound(playerid10570.00.00.0);
new 
string[144];
format(stringsizeof(string), "admin %s[%i] has given you money $%i."ReturnPlayerName(playerid), playeridamount);
SendClientMessage(targetCOLOR_DODGER_BLUEstring);
format(stringsizeof(string), "You have given %s[%i]'s money $%i."ReturnPlayerName(target), targetamount);
SendClientMessage(playeridCOLOR_DODGER_BLUEstring);
return 
1;

tell us what is printing on log
Reply
#4

It is saying the specified player isn't connected..
Reply
#5

Quote:
Originally Posted by HassanShah
Посмотреть сообщение
It is saying the specified player isn't connected..
what? i said what is printing on server log after using the code i given.
Reply
#6

its working, repted ;p
Reply
#7

PHP код:
CMD:givemoney(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 5)
    {
        if(
AdminDuty[playerid] != && PlayerInfo[playerid][pAdmin] < 6)
        {
            
SendClientMessage(playerid,COLOR_WHITE"You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 
1;
        }
        new 
string[128], giveplayeridmoney;
        if(
sscanf(params"ud"giveplayeridmoney)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /givemoney [playerid/partofname] [money]");

        if(
IsPlayerConnected(giveplayerid))
        {
            
GivePlayerCash(giveplayeridmoney);
            
format(stringsizeof(string), "You have given %s $%d!",GetPlayerNameEx(giveplayerid),money);
            
SendClientMessage(playeridCOLOR_WHITEstring);
            
format(stringsizeof(string), "%s has given %s $%d (via /givemoney)"GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid),money);
            
Log("logs/adminmoney.log"string);
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    }
    return 
1;

use this its better or need more help in script contact me on fb ********.com/usamakhalid666
Reply
#8

Quote:
Originally Posted by HassanShah
Посмотреть сообщение
its working, repted ;p
all did what i just put a printf statement and it started to work ...well ok then lol
Quote:
Originally Posted by Usama651
Посмотреть сообщение
PHP код:
CMD:givemoney(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 5)
    {
        if(
AdminDuty[playerid] != && PlayerInfo[playerid][pAdmin] < 6)
        {
            
SendClientMessage(playerid,COLOR_WHITE"You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 
1;
        }
        new 
string[128], giveplayeridmoney;
        if(
sscanf(params"ud"giveplayeridmoney)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /givemoney [playerid/partofname] [money]");
        if(
IsPlayerConnected(giveplayerid))
        {
            
GivePlayerCash(giveplayeridmoney);
            
format(stringsizeof(string), "You have given %s $%d!",GetPlayerNameEx(giveplayerid),money);
            
SendClientMessage(playeridCOLOR_WHITEstring);
            
format(stringsizeof(string), "%s has given %s $%d (via /givemoney)"GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid),money);
            
Log("logs/adminmoney.log"string);
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    }
    return 
1;

use this its better or need more help in script contact me on fb ********.com/usamakhalid666
do you think it will work? no for sure. cause these copy pasted thing will give him error as the vars in his script and this one doesnt match.
Reply
#9

Quote:
Originally Posted by HassanShah
Посмотреть сообщение
its working, repted ;p

He didn't even change any code.. You do realise print(..) just 'echo's in the console and nothing else?
Reply


Forum Jump:


Users browsing this thread: