10.08.2009, 09:16
My English isn't cery good ^^
Код:
if(strcmp(cmd, "/dealen", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[USAGE:] /dealen [PlayerID/Name] [Amount]");
return 1;
}
new Float:gzx, Float:gzy, Float:gzz; GetPlayerPos(playerid,gzx,gzy,gzz);
for(new zone = 0; zone < MAX_ZONES; zone++)
{
if(gzx >= ZoneLocations[zone][0] && gzx < ZoneLocations[zone][2] && gzy >= ZoneLocations[zone][1] && gzy < ZoneLocations[zone][3])
{
if(ZoneInfo[zone][ZoneOwnerID] != PlayerInfo[playerid][pFaction]) // if Dealer != ZoneOwner
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] You are not in your Zone!");
return 1;
}
}
}
new playa;
new needed;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
return 1;
}
needed = strval(tmp);
if(needed < 1 || needed > 10)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] Max Amount is 10g");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
return 1;
}
if(needed > PlayerInfo[playerid][pGras])
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] You don't have so much!");
return 1;
}
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, playa))
{
/*new Float:gzx, Float:gzy, Float:gzz; GetPlayerPos(playerid,gzx,gzy,gzz);
for(new zone = 0; zone < MAX_ZONES; zone++)
{
if(gzx >= ZoneLocations[zone][0] && gzx < ZoneLocations[zone][2] && gzy >= ZoneLocations[zone][1] && gzy < ZoneLocations[zone][3])
{
if(ZoneInfo[zone][ZoneOwnerID] == PlayerInfo[playerid][pFaction]) // if Dealer != ZoneOwner
{*/
if(playa != playerid)
{
format(string, sizeof(string), "[INFO:] You have sold %s %d g Weed ", GetPlayerNameEx(playa), needed);
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string);
format(string, sizeof(string), "[INFO:] %s has sold you %d g Weed.", GetPlayerNameEx(playerid), needed);
SendClientMessage(playa, COLOR_LIGHTYELLOW2, string);
PlayerInfo[playa][pGras] += needed;
PlayerInfo[playerid][pGras] -= needed;
PlayerPlayerActionMessage(playerid,playa,15.0,"give Weed to");
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] You can't sell Weed to yourself!");
}
/* }
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] You are not in your own Zone!");
}
}
}*/
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] This player isn't near enough!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] False ID.");
}
}
return 1;
}

