My commands aren't working? -
Jochemd - 30.04.2010
Hello,
I got some weird bugs in my server with the commands. They don't work. I show you the code.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(deposit,7,cmdtext);
dcmd(withdraw,8,cmdtext);
dcmd(bank,4,cmdtext);
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
new string[248];
if (strcmp("/licenses", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,-2031.7733,-116.9298,1035.1719))
{
new dtests[] = "1\tDriving License - 800$\n2\tFlying License - 2000$\n3\tGun License - 500$";
ShowPlayerDialog(playerid,999,DIALOG_STYLE_LIST,"Licenses, Chose One:",dtests,"Test","Exit");
return 1;
}
else if(!IsPlayerInRangeOfPoint(playerid,5.0,-2031.7733,-116.9298,1035.1719))
{
SendClientMessage(playerid,grey,"--> This command is only used at the SanFiero School.");
}
return 1;
}
if (strcmp("/sl", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,grey," Use: /sl [driving/flying/gun].");
return 1;
}
if (strcmp("/sl driving", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][DrivingLicense] == 0)
{
format(string,sizeof(string)," %s doesnt have a valid Driving License",pName);
SendClientMessageToAll(aquablue,string);
}
else if(PlayerInfo[playerid][DrivingLicense] == 1)
{
format(string,sizeof(string)," %s shows a legit Driving License.",pName);
SendClientMessageToAll(aquablue,string);
}
return 1;
}
if (strcmp("/sl flying", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][FlyingLicense] == 0)
{
format(string,sizeof(string)," %s doesn't have a valid Flying License",pName);
SendClientMessageToAll(aquablue,string);
}
else if(PlayerInfo[playerid][FlyingLicense] == 1)
{
format(string,sizeof(string)," %s shows a legit Flying License.",pName);
SendClientMessageToAll(aquablue,string);
}
}
if (strcmp("/sl gun", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][GunLicense] == 0)
{
format(string,sizeof(string)," %s doesn't have a valid Gun License",pName);
SendClientMessageToAll(aquablue,string);
}
else if(PlayerInfo[playerid][GunLicense] == 1)
{
format(string,sizeof(string)," %s shows a legit Gun License.",pName);
SendClientMessageToAll(aquablue,string);
}
}
return 0;
}
And here are the DCMD commands, if you need them (they don't work to, so the bug must be in OnPlayerCommandText)
pawn Код:
dcmd_bank(playerid,params[])
{
#pragma unused params
if (IsPlayerInRangeOfPoint(playerid,20.0,1459.22, -1012.63, 28.84) || IsPlayerInRangeOfPoint(playerid,20.0,-1495.398,919.942,7.187))
{
ShowPlayerDialog(playerid,DIALOG_BANK,DIALOG_STYLE_LIST,"--> Withdraw, deposit, or see how much money you have?","Deposit\nWithdraw\nCheck Bank Account","Choose","Cancel");
}
else return SendClientMessage(playerid,red,"--> You must be near the Bank! [The Money Sign]");
return 1;
}
dcmd_deposit(playerid,params[])
{
new amout=strval(params);
if (IsPlayerInRangeOfPoint(playerid,20.0,1459.22, -1012.63, 28.84))
{
if (strlen(params)>0)
{
if (IsNumeric(params))
{
if (GetPlayerMoney(playerid)>=amout)
{
GivePlayerMoney(playerid,-amout);
bnk_UserSetInt(PlayerName(playerid),"in",bnk_UserInt(PlayerName(playerid),"in")+amout);
new string[200];
format(string,sizeof(string),"--> You have succesfully deposited %i$ , Now in bank : %i$ .",amout,bnk_UserInt(PlayerName(playerid),"in"));
SendClientMessage(playerid,red,string);
}
else return SendClientMessage(playerid,red,"--> You don't have enough money!");
}
else return SendClientMessage(playerid,red,"--> Amout must be numeric !");
}
else return SendClientMessage(playerid,red,"--> Syntax Error: /deposit [AMOUT]");
}
else return SendClientMessage(playerid,red,"--> You must be near a bank . ");
return 1;
}
dcmd_withdraw(playerid,params[])
{
new amout=strval(params);
if (IsPlayerInRangeOfPoint(playerid,20.0,1459.22, -1012.63, 28.84))
{
if (strlen(params)>0)
{
if (IsNumeric(params))
{
if (amout<=bnk_UserInt(PlayerName(playerid),"in"))
{
bnk_UserSetInt(PlayerName(playerid),"in",bnk_UserInt(PlayerName(playerid),"in")-amout);
new string[200];
format(string,sizeof(string),"--> You have succesfully withdrawed %i$ , Now in bank : %i$ .",amout,bnk_UserInt(PlayerName(playerid),"in"));
SendClientMessage(playerid,yellow,string);
GivePlayerMoney(playerid,amout);
}
else return SendClientMessage(playerid,red,"--> Not enough money in the bank!");
}
else return SendClientMessage(playerid,red,"--> Amout must be numeric !");
}
else return SendClientMessage(playerid,red,"--> Syntax Error: /withdraw [amount]");
}
else return SendClientMessage(playerid,red,"--> You must be near the bank");
return 1;
}
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
Re: My commands aren't working? -
Jochemd - 01.05.2010
bump, please, I really need help...
Re: My commands aren't working? -
Lookin - 03.10.2011
yeah all of a sudden myn quite working a well
Код:
if (strcmp("/rules", cmdtext, true, 6) == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF, ".::Rules::.");
SendClientMessage(playerid, 0xFFFFFFFF, "#1.Keep Profane Language to a Minimum.");
SendClientMessage(playerid, 0xFFFFFFFF, "#2.No Spamming or Adverts.");
SendClientMessage(playerid, 0xFFFFFFFF, "#3.No intentional spawnkilling.");
SendClientMessage(playerid, 0xFFFFFFFF, "#4.Do not bother people who do not want to be bothered.");
SendClientMessage(playerid, 0xFFFFFFFF, "#5.Please report anything you see via /report [id] (reason) or use the forums.");
SendClientMessage(playerid, 0xFFFFFFFF, "#6.Please check /help & /help2 before approaching an admin for help.");
SendClientMessage(playerid, 0xFFFFFFFF, "#7.Don't ask anyone for admin or money, PERIOD!!");
SendClientMessage(playerid, 0xFFFFFFFF, "#8.Do not hack, cheat, or use third party mods that affect multiplayer gameplay.");
SendClientMessage(playerid, 0xFFFFFFFF, "#9.Please respect all admins and PCRP Members and what they ask of you.");
return 1;
}
and im using the original format
Re: My commands aren't working? -
System64 - 03.10.2011
I think that you can't use DCMD and strcmp commands
Re: My commands aren't working? -
Zonoya - 03.10.2011
yes ur right if u want DCMD conver the strcmp cmds to DCMD
Re: My commands aren't working? -
Kush - 03.10.2011
Here's the thing... This was posted back in 2010...
Re: My commands aren't working? -
Zonoya - 03.10.2011
lol i just noticed xD
Re: My commands aren't working? -
Lookin - 03.10.2011
aw shit my bad was up all night didn't even think to look at that sorry guys ill go make a new topic