Some Errors -
SnG.Scot_MisCuDI - 06.01.2012
how can i make a /gc command? Here is what i made
pawn Код:
CMD:gc(playerid,params[])
{
new pname[24], targetid, string[128];
new cash = strval(tmp2);
if(IsPlayerLuxAdmin(playerid))
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");
GetPlayerName(targetid, pname, 24);
GivePlayerMoney(targetid,cash)
format(string, 128, "** ADMIN CASH: You have been given %s.",cash);
SendClientMessage(string,0xFF00FFFF, targetid);
return 1;
}
I get these errors
pawn Код:
(262) : error 017: undefined symbol "tmp2"
(270) : error 035: argument type mismatch (argument 2)
pawn Код:
262: new cash = strval(tmp2);
270: SendClientMessage(string,0xFF00FFFF, targetid);
Re: give cash -
[BG]Gamer - 06.01.2012
Код:
CMD:gc(playerid,params[])
{
new pname[24], targetid, string[128], tmp[128];
new cash = strval(tmp2);
if(IsPlayerLuxAdmin(playerid))
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");
GetPlayerName(targetid, pname, 24);
GivePlayerMoney(targetid,cash)
format(string, 128, "** ADMIN CASH: You have been given %s.",cash);
SendClientMessage(targetid,0xFF00FFFF, string);
return 1;
}
Should be like this.
Re: give cash -
SnG.Scot_MisCuDI - 06.01.2012
It doesnt give the player money, but no errors
pawn Код:
CMD:gc(playerid,params[])
{
new pname[24], targetid, string[128], tmp[128];
new cash = strval(tmp);
if(IsPlayerLuxAdmin(playerid))
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");
GetPlayerName(targetid, pname, 24);
GivePlayerMoney(targetid,cash);
format(string, 128, "** ADMIN CASH: You have been given %s.",cash);
SendClientMessage(targetid,0xFF00FFFF,string);
return 1;
}
Re: give cash -
[BG]Gamer - 06.01.2012
Код:
CMD:gc(playerid,params[])
{
new pname[24], targetid, string[128];
new cash = strval(params);
if(IsPlayerLuxAdmin(playerid))
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");
GetPlayerName(targetid, pname, 24);
GivePlayerMoney(targetid,cash);
format(string, 128, "** ADMIN CASH: You have been given %s.",cash);
SendClientMessage(targetid,0xFF00FFFF,string);
return 1;
}
This way it will work
Re: give cash -
fordawinzz - 06.01.2012
If you use sscanf, why don't you use like this:
pawn Код:
CMD:gc(playerid,params[])
{
new pname[24], cash, targetid, string[128];
if(!IsPlayerLuxAdmin(playerid)) continue;
if(sscanf(params,"ui",targetid, cash)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid] [cash]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");
GetPlayerName(targetid, pname, 24);
GivePlayerMoney(targetid, cash);
format(string, 128, "** ADMIN CASH: You have been given $%d.", cash);
SendClientMessage(targetid,0xFF00FFFF,string);
return 1;
}
?
Re: give cash -
SnG.Scot_MisCuDI - 07.01.2012
error 024: "break" or "continue" is out of context
Re: give cash -
[ABK]Antonio - 07.01.2012
lol really....
pawn Код:
CMD:agivecash(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new id, money, name[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME];
if(sscanf(params, "ui", id, money)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /givecash <id/partofname> <amount>");
GivePlayerMoney(id, money);
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(id, name, sizeof(name));
format(str,sizeof(str), "Admin %s has given you $%d!", aname, money);
SendClientMessage(id, -1, str);
format(str,sizeof(str), "You have given %s $%d!", name, money);
SendClientMessage(playerid, -1, str);
}
else return SendClientMessage(playerid, 0xCC0000AA, "You aren't an admin!");
return 1;
}
CMD:gc(playerid, params[]) return cmd_agivecash(playerid, params);
Re: give cash -
Richie - 07.01.2012
pawn Код:
CMD:gc(playerid,params[])
{
new pname[24], cash, targetid, string[128];
if(!IsPlayerLuxAdmin(playerid)) return SendClientMessage(playerid, -1, "Error: You are not admin");
if(sscanf(params,"ui",targetid, cash)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid] [cash]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");
GetPlayerName(targetid, pname, 24);
GivePlayerMoney(targetid, cash);
format(string, 128, "** ADMIN CASH: You have been given $%d.", cash);
SendClientMessage(targetid,0xFF00FFFF,string);
return 1;
}