31.05.2014, 11:51
Hello,
I have a drug system and if I have a drug plant to plant anything goes but if I plant a second on is at the second "This is not a drug plant". But at the first ever why?
COde:
Enum:
Sry, for this englisch i form german
I have a drug system and if I have a drug plant to plant anything goes but if I plant a second on is at the second "This is not a drug plant". But at the first ever why?
COde:
Код:
ocmd:drogepflanzen(playerid,params[]) { if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GREY, "Du musst zu FuЯ sein!"); if (GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid, COLOR_GREY, "Du darfst in kein Gebдude sein!"); if (SpielerInfo[playerid][pDrogensamen]<9) { SendClientMessage(playerid, COLOR_GREY,"Du hast nicht genug Samen."); return 1; } if (SpielerInfo[playerid][pDrugsplanted]>5) { SendClientMessage(playerid,COLOR_RED,"Du kannst nur 6 Drogenpflanzen anpflanzen, ernte zuerst die Anderen!"); return 1; } for(new weed = 1; weed < sizeof(WeedInfo); weed++) { if(WeedInfo[weed][wPlanted] == 0 && WeedInfo[weed][wTime] == 0) { new Float:X,Float:Y,Float:Z,string2[200],ss[200]; ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0); GetPlayerPos(playerid, X, Y, Z); WeedInfo[weed][wObject] = CreateDynamicObject(3409, X, Y, Z-2.0, 0, 0, 0, 0); WeedInfo[weed][wX] = X; WeedInfo[weed][wY] = Y; WeedInfo[weed][wZ] = Z; WeedInfo[weed][wTime] = 25; WeedInfo[weed][wPlanted] = 1; strmid(WeedInfo[weed][WeedPlanter],SpielerName(playerid), 0, strlen(SpielerName(playerid)), 50); format(ss,sizeof(ss),"Canabis-Droge\nPflanzer: %s\nZeit bis Ernte: %d Minuten",SpielerName(playerid),WeedInfo[weed][wTime]); WeedInfo[weed][Weedlbl] = Create3DTextLabel(ss,COLOR_WHITE,X,Y,Z,10.0,0,0); SpielerInfo[playerid][pDrogensamen]-=9; SpielerInfo[playerid][pDrugsplanted]++; SetTimerEx("DrogenTime",60000,0,"d",weed); SendClientMessage(playerid,COLOR_GREEN,"Du hast erfolgreich eine Droge angepflanzt ( Du musst noch 25 Minuten warten! )"); format(string2,sizeof(string2),"INSERT INTO `drogen` (`id`,`Pflanzer`,`Time`,`X`,`Y`,`Z`) VALUES ('%d','%s','%d','%f','%f','%f')",weed,WeedInfo[weed][WeedPlanter],WeedInfo[weed][wTime],WeedInfo[weed][wX],WeedInfo[weed][wY],WeedInfo[weed][wZ]); mysql_query(string2); return 1; } } return 1; } ocmd:drogeernten(playerid,params[]) { for(new weed = 1; weed < sizeof(WeedInfo); weed++) { new string2[120]; if(IsPlayerInRangeOfPoint(playerid,6.0,WeedInfo[weed][wX],WeedInfo[weed][wY],WeedInfo[weed][wZ])) { if(WeedInfo[weed][wPlanted] == 1) { if(WeedInfo[weed][wTime] <= 0) { ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0); DestroyDynamicObject(WeedInfo[weed][wObject]); format(query,sizeof(query),"DELETE FROM drogen WHERE id='%i'",weed); mysql_query(query); SendClientMessage(playerid,COLOR_GREEN,"Du hast die Drogenpflanze erfolgreich abgepflanzt!"); SpielerInfo[playerid][pDrugsplanted]--; Delete3DTextLabel(WeedInfo[weed][Weedlbl]); return 1; } else { format(string2,sizeof(string2),"Deine Pflanze ist noch nicht fertig du musst noch %d Minuten warten.",WeedInfo[weed][wTime]); SendClientMessage(playerid, COLOR_RED, string2); return 1; } } } else { SendClientMessage(playerid,COLOR_RED,"Hier ist keine Drogepflanze!"); return 1; } } return 1; }
Код:
enum wInfo { wPlanted, WeedPlanter[MAX_PLAYER_NAME], wTime, wObject, Float:wX, Float:wY, Float:wZ, wWeed, Text3D:Weedlbl }; new WeedInfo[1000][wInfo];