22.07.2012, 11:30
Hello, i have this cmd to sell some drugs to another player
only problem is that someone could go around selling drugs to people and effectively "rob them of their money" so i was thinking to make a cmd "offerdrugs" and it will set a variable to the other player that he has been offerd drugs now he needs to /acceptdugs which will put him in another variable basivly saying he is ready to accept deals of the other person now i made it and got some errors ill place code underneath with the warnings
sorry for the cmds small and not completely finished i was rushing it 
p.s if u see any flaws in this method can you please tell me and suggest a better way
only problem is that someone could go around selling drugs to people and effectively "rob them of their money" so i was thinking to make a cmd "offerdrugs" and it will set a variable to the other player that he has been offerd drugs now he needs to /acceptdugs which will put him in another variable basivly saying he is ready to accept deals of the other person now i made it and got some errors ill place code underneath with the warnings
pawn Код:
CMD:giveheroin(playerid, params[])
{
if(gTeam[playerid] == DRUG)
{
new id, ammount, money, string[128], string2[128];
if(sscanf(params,"uii",id,ammount,money)) return SendClientMessage(playerid, -1, "USAGE: /giveheroin <id/name> <grams> <moneywanted> ");
if(GetPlayerHeroin(playerid) < ammount) return SendClientMessage(playerid, -1, "You do not have that much grams!");
if(GetPlayerMoney(id) < money) return SendClientMessage(playerid, COLOR_RED, "This player does not have those funds");
GivePlayerMoney(id, -money);
GivePlayerMoney(playerid, money);
GivePlayerHeroin(id, ammount);
format(string, sizeof(string), "You have given %s %d grams of heroin Dont forget to get payed!", PlayerName(id), ammount);
format(string2, sizeof(string2), "You have recived %d grams of heroin dont forget to pay him!", ammount, PlayerName(playerid));
SendClientMessage(playerid, -1, string);
SendClientMessage(id, -1, string2);
personoffer[playerid] = false;
readydeal[id] = false;
return 1;
}
else if(gTeam[playerid] != DRUG)
{
SendClientMessage(playerid, -1, "You are not a drug dealer");
return 1;
}
return 1;
}
CMD:offerdrugs(playerid, params[])
{
new id;
if(sscanf(params,"u",id))
offerddrugs[id] = true;
personoffer[playerid] = true;
return 1;
}
CMD:acceptdeal(playerid, params[])
{
new id ,string[128];
if(sscanf(params,"u",id))
if(personoffer[id] = false) return SendClientMessage(playerid, -1, "This person hasnt offerd drugs");
format(string, sizeof(string), "%s is accepting deals");
if(id == gTeam[id] != DRUG) return SendClientMessage(playerid, -1, "This player isnt a dealer");
SendClientMessage(id, -1, string);
readydeal[playerid] = true;
return 1;
}
Код:
C:\Users\iphone\Desktop\Pawn Scripting\gamemodes\Sfcnr.pwn(1340) : warning 211: possibly unintended assignment C:\Users\iphone\Desktop\Pawn Scripting\gamemodes\Sfcnr.pwn(1342) : warning 213: tag mismatch Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Warnings.

p.s if u see any flaws in this method can you please tell me and suggest a better way
