10.08.2009, 09:11
Hello Guys,
I've a problem and hope you can help me.
I tried to make a different drugdealer-command. The player can only deal in his own turf/zone.
But when I am testing, nothing happens.
I tried it on two ways, but it doesn't want to work.
Here is the cmd:
The second try ist in a comment .. you can see it ..
I've a problem and hope you can help me.
I tried to make a different drugdealer-command. The player can only deal in his own turf/zone.
But when I am testing, nothing happens.
I tried it on two ways, but it doesn't want to work.
Here is the cmd:
Код:
if(strcmp(cmd, "/dealen", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "[BENUTZUNG:] /dealen [SpielerID/Name] [Anzahl]"); 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]) // falls der Dealer = GebietBesitzer { SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] Du bist nicht in deinem Viertel!"); 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:] Du kannst hцchstens 10 Gramm verticken"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { return 1; } if(needed > PlayerInfo[playerid][pGras]) { SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] Soviel hast du nicht!"); 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]) // falls der Dealer = GebietBesitzer {*/ if(playa != playerid) { format(string, sizeof(string), "[INFO:] Du hast %s %d Gramm Gras vertickt.", GetPlayerNameEx(playa), needed); SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string); format(string, sizeof(string), "[INFO:] %s hat dir %d Gramm Gras.", GetPlayerNameEx(playerid), needed); SendClientMessage(playa, COLOR_LIGHTYELLOW2, string); PlayerInfo[playa][pGras] += needed; PlayerInfo[playerid][pGras] -= needed; PlayerPlayerActionMessage(playerid,playa,15.0,"ьbergibt ein Tьtchen mit Gras an"); } else { SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] Du kannst dir selber kein Gras verticken!"); } /* } else { SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] Du bist nicht in deinem Viertel!"); } } }*/ } else { SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] Diese Spieler ist zu weit entfernt!"); } } } else { SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR:] Ungьltige ID."); } } return 1; }