28.08.2012, 10:59
/give [playerid] [potion]
______________________
Any help ?
______________________
Any help ?
CMD:sethealth(playerid,params[])
{
if(pInfo[playerid][Admin] < 2) return error
new user,health;
if(sscanf(params,"ud",user,health)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"SYNTAX:/sethealth [playerid] [health]");
if(user == INVALID_PLAYER_ID) return invalid
SetPlayerHealth(user,health);
return 1;
}
if(strcmp(cmd, "/give", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /give [playerid/PartOfName] [name] [amount]");
SendClientMessage(playerid, COLOR_GRAD1, "Available names: Pot, Crack, Materials, Seeds, Gun");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /give [playerid/PartOfName] [name] [amount]");
SendClientMessage(playerid, COLOR_GRAD1, "Available names: Pot, Crack, Materials, Seeds, Gun");
return 1;
}
if(strcmp(tmp,"pot",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /give [playerid/PartOfName] [name] [amount]");
SendClientMessage(playerid, COLOR_GRAD1, "Available names: Pot, Crack, Materials, Seeds, Gun");
return 1;
}
new amount = strvalEx(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(playerid == giveplayerid) { SendClientMessage(playerid, COLOR_GREY, " You can't give to yourself !"); return 1; }
if(amount > PlayerInfo[playerid][pPot] || amount < 1) { SendClientMessage(playerid, COLOR_GREY, " You don't have that much !"); return 1; }
if(amount > 50 || PlayerInfo[giveplayerid][pPot]+amount > 50) { SendClientMessage(playerid, COLOR_GREY, " That player cannot hold more than 50 Pot !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), " You have given %s %d Pot.", giveplayer, amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " You have recieved %d Pot from %s.", amount, sendername);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
format(string, sizeof(string), "* %s has given %s some Pot.", sendername, giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[playerid][pPot] = PlayerInfo[playerid][pPot]-amount;
PlayerInfo[giveplayerid][pPot] = PlayerInfo[giveplayerid][pPot]+amount;
format(string, sizeof(string), "%s has given %s %d Pot.", sendername, giveplayer, amount);
PayLog(string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
if(strcmp(tmp,"crack",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /give [playerid/PartOfName] [name] [amount]");
SendClientMessage(playerid, COLOR_GRAD1, "Available names: Pot, Crack, Materials, Seeds, Gun");
return 1;
}
new amount = strvalEx(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(playerid == giveplayerid) { SendClientMessage(playerid, COLOR_GREY, " You can't give to yourself !"); return 1; }
if(amount > PlayerInfo[playerid][pCrack] || amount < 1) { SendClientMessage(playerid, COLOR_GREY, " You don't have that much !"); return 1; }
if(amount > 25 || PlayerInfo[giveplayerid][pCrack]+amount > 25) { SendClientMessage(playerid, COLOR_GREY, " That player cannot hold more than 25 Crack !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), " You have given %s %d Crack.", giveplayer, amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " You have recieved %d Crack from %s.", amount, sendername);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
format(string, sizeof(string), "* %s has given %s some Crack.", sendername, giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[playerid][pCrack] = PlayerInfo[playerid][pCrack]-amount;
PlayerInfo[giveplayerid][pCrack] = PlayerInfo[giveplayerid][pCrack]+amount;
format(string, sizeof(string), "%s has given %s %d Crack.", sendername, giveplayer, amount);
PayLog(string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
if(strcmp(tmp,"materials",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /give [playerid/PartOfName] [name] [amount]");
SendClientMessage(playerid, COLOR_GRAD1, "Available names: Pot, Crack, Materials, Seeds, Gun");
return 1;
}
new amount = strvalEx(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(playerid == giveplayerid) { SendClientMessage(playerid, COLOR_GREY, " You can't give to yourself !"); return 1; }
if(amount > PlayerInfo[playerid][pMats] || amount < 1) { SendClientMessage(playerid, COLOR_GREY, " You don't have that much !"); return 1; }
if(amount > 50000) { SendClientMessage(playerid, COLOR_GREY, " You can't give more than 50,000 at a time !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), " You have given %s %d Materials.", giveplayer, amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " You have recieved %d Materials from %s.", amount, sendername);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
format(string, sizeof(string), "* %s has given %s some Materials.", sendername, giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[playerid][pMats] -= amount;
PlayerInfo[giveplayerid][pMats] += amount;
format(string, sizeof(string), "%s has given %s %d Materials.", sendername, giveplayer, amount);
PayLog(string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
if(strcmp(tmp,"seeds",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /give [playerid/PartOfName] [name] [amount]");
SendClientMessage(playerid, COLOR_GRAD1, "Available names: Pot, Crack, Materials, Seeds, Gun");
return 1;
}
new amount = strvalEx(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(playerid == giveplayerid) { SendClientMessage(playerid, COLOR_GREY, " You can't give to yourself !"); return 1; }
if(amount > PlayerInfo[playerid][pSeeds] || amount < 1) { SendClientMessage(playerid, COLOR_GREY, " You don't have that much !"); return 1; }
if(amount > 10) { SendClientMessage(playerid, COLOR_GREY, " You can't give more than 10 at a time !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), " You have given %s %d Seeds.", giveplayer, amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " You have recieved %d Seeds from %s.", amount, sendername);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
format(string, sizeof(string), "* %s has given %s some Seeds.", sendername, giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[playerid][pSeeds] -= amount;
PlayerInfo[giveplayerid][pSeeds] += amount;
format(string, sizeof(string), "%s has given %s %d Seeds.", sendername, giveplayer, amount);
PayLog(string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
if(strcmp(tmp,"Weapon",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /give [playerid/PartOfName] [name]");
SendClientMessage(playerid, COLOR_GRAD1, "Available names: Pot, Crack, Materials, Seeds, Gun");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(playerid == giveplayerid) { SendClientMessage(playerid, COLOR_GREY, " You can't give to yourself !"); return 1; }
new WeaponName[65], weap;
GetWeaponName(weap,WeaponName,64);
weap = GetPlayerWeapon(playerid);
TakeWeapon(playerid, weap);
GivePlayerGun(giveplayerid, weap);
format(string, sizeof(string), " You have given %s a %s.", PlayerName(giveplayerid), WeaponName);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " You have recieved a %s from %s.", WeaponName, PlayerName(playerid));
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
format(string, sizeof(string), "* %s takes out a Weapon and hands it to %s", PlayerName(playerid), PlayerName(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
format(string, sizeof(string), "%s has given %s a %s.", sendername, giveplayer, WeaponName);
PayLog(string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Invalid give name !");
return 1;
}
}
return 1;
}
CMD:giveweapon(playerid,params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid)) //Only for rcon.if you want to use your admin,replace this line.
return SendClientMessage(playerid, 0xFF0000, "You need to be admin to use this command");
new target;
new weaponid;
new ammo;
if(sscanf(params,"uii",target,weaponid,ammo)) return SendClientMessage(playerid, 0xFF0000, "Usage:/giveweapon [playerid] [weaponid] [ammo]");
if(weaponid > 54 || weaponid < 1) return SendClientMessage(playerid, 0xFFFFFFF,"Invalid weapon id! Available ID's: 1-54");
GivePlayerWeapon(target,weaponid,ammo);
return 1;
}