a system for adding modules. (example: sa-mp)
for irc, sql, etc...
for irc, sql, etc...
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: Afaque on August 24, 2010, 11:27:49 AM
ip :192.168.1.2
please give one chance
else if (strcmp(cmd, "!givecash", true) == 0) {
new tmp2[256], plr;
tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if (!strlen(tmp2)) SendClientMessage(playerid,COLOR_GREEN, "USAGE: !givecash [Nick/ID] [Amount]");
else if (GetPlayerHandCash(gPlayers[playerid]) < StrToInt(tmp2)) SendClientMessage(playerid,COLOR_GREEN, "Error: You havent got the needed money.");
else if (plr != INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else if(!IsPlayerRegistered(gPlayers[plr])) SendClientMessage(playerid, COLOR_RED, "Error: That nick is not registered!");
else if (!IsNumeric(tmp2)) SendClientMessage(playerid,COLOR_GREEN, "Error: Invalid Amount!");
else {
format(szMsg,sizeof(szMsg),"You have sent:[ $%d ] to:[ %s ]",tmp,gPlayers[playerid]);
SendClientMessage(playerid,COLOR_GREEN, szMsg);
DecPlayerHandCash(playerid,StrToInt(tmp));
IncPlayerHandCash(plr,StrToInt(tmp));
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if(text[0] == !)
{
new tmp[64], idx;
tmp = strtok(text, idx);
commands(playerid, 0, tmp, text[strlen(tmp) + 1]);
}
return 1;
}
public OnPlayerCommand(playerid, cmdtext[])
{
new tmp[64], idx;
tmp = strtok(text, idx);
commands(playerid, 1, tmp, text[strlen(tmp) + 1]);
return 1;
}
stock CmdType(type, string[])
{
new str[128];
if(type == 1) format(str, sizeof(str), "* Usage: /c %s", string);
else format(str,sizeof(str), "* Usage: !%s", string);
return str;
}
public commands(playerid, type, cmd[], params[])
{
if(strcmp(params, "wep",true))
{
new weapon[64], ammo[4], wid, am, msg[128];
if(sscanf(params,"sz",weapon, ammo)) return SendMessageToPlayer(playerid, CFG_Color, CmdType(type, "wep <WeaponName/WeaponID> <Ammo>"));
wid = ReturnWeapon(weapon);
if(wid == -1) return SendMessageToPlayer(playerid, CFG_Color, ">> Error: Invalid Weapon!");
if(!strlen(ammo) || !IsNumeric(ammo)) am = 500;
else am = strval(ammo);
format(msg, 128, ">> Weapon Name: %s - Ammo: %d", wid, am);
SendMessageToPlayer(playerid, CFG_Color, msg);
GivePlayerWeapon(playerid, wid, am);
}
return 1;
}