Majitel ffredyk 168 Odesláno: 25. Srpen, 2010 Majitel Share Odesláno: 25. Srpen, 2010 Vytvoreno pod zadosti na ICQ.. #include #define PRVNICHAR "Y" #define DRUHEJCHAR "I" public OnPlayerText(playerid, text[]) { new str[255]; ChangeChar: if(strfind(text,PRVNICHAR,true)) { new pos = strfind(text,PRVNICHAR,true); strdel(str,pos,pos+1); strins(str,DRUHEJCHAR,pos); goto ChangeChar; } else if(strfind(text,DRUHEJCHAR,true)) { new pos = strfind(text,DRUHEJCHAR,true); strdel(str,pos,pos+1); strins(str,PRVNICHAR,pos); goto ChangeChar; } } Link to comment Share on other sites More sharing options...
Guest Frodo Odesláno: 25. Srpen, 2010 Share Odesláno: 25. Srpen, 2010 Strfind - Vyhleda vse stringu urcity "substring" Chapu to dobre? Link to comment Share on other sites More sharing options...
Guest [HQW]MASTER Odesláno: 25. Srpen, 2010 Share Odesláno: 25. Srpen, 2010 nechapem oco tam ide naco to sluzy ani nic Link to comment Share on other sites More sharing options...
Guest Odesláno: 25. Srpen, 2010 Share Odesláno: 25. Srpen, 2010 napíšeš ahojte ste lami a vypíše ahojte ste lamy alebo napíšeš vy kokoti a napíše vi kokoty chcel to asi nurofen Link to comment Share on other sites More sharing options...
Guest Frodo Odesláno: 25. Srpen, 2010 Share Odesláno: 25. Srpen, 2010 Tak to použiju, příjde QWER a řekne "QWER je bůh" a napíše to "QWER je lama" STOP OT Link to comment Share on other sites More sharing options...
Guest [HQW]MASTER Odesláno: 25. Srpen, 2010 Share Odesláno: 25. Srpen, 2010 sak to je kravina Link to comment Share on other sites More sharing options...
Guest Frodo Odesláno: 25. Srpen, 2010 Share Odesláno: 25. Srpen, 2010 sak to je kravina To neni k tomu to jsou funkce treba pro slozity scripty. A tech funkci na upravu stringu je hafo * Strcmp: Compare two strings to check if they are the same. * Strtok: Get the next word/parameter in a string. * Strdel: Delete part of a string. * Strins: Insert text into a string. * Strlen: Get the length of the string. * Strmid: Extract part of a string into another string. * Strpack: Pack a string into a destination. * Strval: Convert a string into an integer. * Strcat: Concatenate two strings into a destination reference. Link to comment Share on other sites More sharing options...
Majitel ffredyk 168 Odesláno: 25. Srpen, 2010 Author Majitel Share Odesláno: 25. Srpen, 2010 Nic smazu to .. Nefunguje to a sem linej to cely prekopavat Dosli sme k zaveru, ze aby to fungovalo zcela spravne je zapotrebi minimalne 4 podminek a oddelenou detekci a prepsani pismen.. to je prace na dlouho a ja sem v tuhle chvili lenoch Link to comment Share on other sites More sharing options...
Guest Frodo Odesláno: 25. Srpen, 2010 Share Odesláno: 25. Srpen, 2010 Nic smazu to .. Nefunguje to a sem linej to cely prekopavat Dosli sme k zaveru, ze aby to fungovalo zcela spravne je zapotrebi minimalne 4 podminek a oddelenou detekci a prepsani pismen.. to je prace na dlouho a ja sem v tuhle chvili lenoch A ceho chces dosahnout? Nepochopil jsem vyznam toho scriptu Link to comment Share on other sites More sharing options...
Guest [HQW]MASTER Odesláno: 25. Srpen, 2010 Share Odesláno: 25. Srpen, 2010 tak mi skus povedat preco mi pise daku chybu ze strtok na riadku ktory ani nemam v mode a robi mi to ia na jednom pc na 2. mam rovnake pawno a tam mi to nepise Link to comment Share on other sites More sharing options...
Guest Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 No nechcem zakladať nové téma na to aby som sem dal script ktorý po mne chcel kamoš, tak ho dávam sem stock Link to comment Share on other sites More sharing options...
MajkX 16 Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 No nechcem zakladať nové téma na to aby som sem dal script ktorý po mne chcel kamoš, tak ho dávam sem stock ChangeChar(str[],char1,char2){ new len = strlen(str); for(new i; i < len+1;i++){ if(str[i] == char1) str[i] = char2; } } potom iba public OnPlayerText(playerid,text[]){ ChangeChar(text,'i','y'); return 1; } Upozorňujem, znak musíte dať do ' ' čiže napríklad 'e' pekny scriptik zide sa obcas Link to comment Share on other sites More sharing options...
Guest OnO97 Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 Jeto dory no ale kdyxz napises kamosovi tak tyto samo odpovi Cau pepo Cau Pepo Coto?Pise dvakrat. Coto?Pise dvakrat. Link to comment Share on other sites More sharing options...
Guest Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 Posiela to 2x ? nemalo by... daj sem tvoj public OnPlayerText Link to comment Share on other sites More sharing options...
Guest OnO97 Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 Posiela to 2x ? nemalo by... daj sem tvoj public OnPlayerText nepochopil jsi,myslel jsem to jinak.. Toje jedno ----------------------- Vzkaz specialne pro QWER-a Pojd na TeamSpeak ts3server://80.79.31.169 Link to comment Share on other sites More sharing options...
Roox 1 Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 Kvér, děláš hrozně neodlehčený scripty... Jde to napsat bez tý proměny.. Navít bez těch zbytečnejch závorek.. stock ChangeChar(str[],char1,char2){ for(new i; i < (strlen(str) +1); i++) if(str[i] == char1) str[i] = char2; } Jinak promiň, že se ti hrabu ve scriptu Link to comment Share on other sites More sharing options...
Majitel ffredyk 168 Odesláno: 7. Říjen, 2011 Author Majitel Share Odesláno: 7. Říjen, 2011 Co se s tim srát... Jednoduše dám ban tomu zmetkovi co ty dva chary neotočí a je po problému Link to comment Share on other sites More sharing options...
Guest Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 Roox nebol by som si istý... testoval som rýchlosti public OnGameModeInit() { SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); new STR[128] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; print("TEST START"); new time = GetTickCount(); for(new i ; i < 1000;i++){ ChangeChar(STR,'A','B'); } print(STR); printf("ChangeChar by QWER %d",GetTickCount()-time); format(STR,128,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); time = GetTickCount(); for(new i ; i < 1000;i++){ ChangeChar2(STR,'A','B'); } print(STR); printf("ChangeChar by Roox %d",GetTickCount()-time); return true; } stock ChangeChar2(str[],char1,char2){ for(new i; i < (strlen(str) +1); i++) if(str[i] == char1) str[i] = char2; } stock ChangeChar(str[],char1,char2){ new len = strlen(str); for(new i; i < len+1;i++){ if(str[i] == char1) str[i] = char2; } } [19] TEST START [19] BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB [19] ChangeChar by QWER 14 [19] BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB [19] ChangeChar by Roox 35 Moje je viac ako 2x rýchlejšie ako tvoje... Link to comment Share on other sites More sharing options...
Roox 1 Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 Roox nebol by som si istý... testoval som rýchlosti public OnGameModeInit() { SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); new STR[128] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; print("TEST START"); new time = GetTickCount(); for(new i ; i < 1000;i++){ ChangeChar(STR,'A','B'); } print(STR); printf("ChangeChar by QWER %d",GetTickCount()-time); format(STR,128,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); time = GetTickCount(); for(new i ; i < 1000;i++){ ChangeChar2(STR,'A','B'); } print(STR); printf("ChangeChar by Roox %d",GetTickCount()-time); return true; } stock ChangeChar2(str[],char1,char2){ for(new i; i < (strlen(str) +1); i++) if(str[i] == char1) str[i] = char2; } stock ChangeChar(str[],char1,char2){ new len = strlen(str); for(new i; i < len+1;i++){ if(str[i] == char1) str[i] = char2; } } [19] TEST START [19] BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB [19] ChangeChar by QWER 14 [19] BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB [19] ChangeChar by Roox 35 Moje je viac ako 2x rýchlejšie ako tvoje... Tak to je kravina.. Rychlostně by to mělo být úplně stejné (Udělej test znovu při stále stejném výkonu procesoru a operační paměti) a to moje odlehčuje 32 bitovou proměnnou.. Link to comment Share on other sites More sharing options...
Guest Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 Tie zátvorky píšem lebo sa mi to pri Funkciách páči ale publicy to je na kope... xD BTW Ja som netestoval RAM ale CPU... tvoje musí stále počítať počet znakov v stringu moje nie... moje to má pekne uložené... EDIT teraz som to dal 10x opakovať a výsledok je jasný [19] ChangeChar by QWER 12 [19] ChangeChar by Roox 32 [19] ChangeChar by QWER 11 [19] ChangeChar by Roox 32 [19] ChangeChar by QWER 12 [19] ChangeChar by Roox 31 [19] ChangeChar by QWER 12 [19] ChangeChar by Roox 31 [19] ChangeChar by QWER 12 [19] ChangeChar by Roox 32 [19] ChangeChar by QWER 12 [19] ChangeChar by Roox 32 [19] ChangeChar by QWER 12 [19] ChangeChar by Roox 32 [19] ChangeChar by QWER 12 [19] ChangeChar by Roox 32 [19] ChangeChar by QWER 12 [19] ChangeChar by Roox 32 [19] ChangeChar by QWER 12 [19] ChangeChar by Roox 32 SCRIPT public OnGameModeInit() { SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); new STR[128],time; print("TEST START"); for(new x; x < 10;x++){ format(STR,128,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); time = GetTickCount(); for(new i ; i < 1000;i++){ ChangeChar(STR,'A','B'); } printf("ChangeChar by QWER %d",GetTickCount()-time); format(STR,128,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); time = GetTickCount(); for(new i ; i < 1000;i++){ ChangeChar2(STR,'A','B'); } printf("ChangeChar by Roox %d",GetTickCount()-time); } return true; } stock ChangeChar2(str[],char1,char2){ for(new i; i < (strlen(str) +1); i++) if(str[i] == char1) str[i] = char2; } stock ChangeChar(str[],char1,char2){ new len = strlen(str); for(new i; i < len+1;i++){ if(str[i] == char1) str[i] = char2; } } Link to comment Share on other sites More sharing options...
Roox 1 Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 To je zas pravda, ale je důležité se rozhodnout, jestli radši zatěžovat RAM a nebo CPU, protože třeba rozdíl nějakých 16 ms hráč nemá šanci poznat.. Link to comment Share on other sites More sharing options...
Guest Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 áno, ale je to môj zvyk kebyže to stále robia ľudia ako ty že radšej obetujú CPU miesto RAM (ram je omnoho lacnejšia a je jej "viac") tak by to dopadlo asi takto if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 593 || //Dodo GetVehicleModel(GetPlayerVehicleID(playerid)) == 592 || //Andromada GetVehicleModel(GetPlayerVehicleID(playerid)) == 577 || //AT400 GetVehicleModel(GetPlayerVehicleID(playerid)) == 563 || //Raindance GetVehicleModel(GetPlayerVehicleID(playerid)) == 553 || //Nevada GetVehicleModel(GetPlayerVehicleID(playerid)) == 548 || //Cargobob GetVehicleModel(GetPlayerVehicleID(playerid)) == 520 || //Hydra GetVehicleModel(GetPlayerVehicleID(playerid)) == 519 || //Shamal GetVehicleModel(GetPlayerVehicleID(playerid)) == 513 || //Stuntplane GetVehicleModel(GetPlayerVehicleID(playerid)) == 512 || //Cropduster GetVehicleModel(GetPlayerVehicleID(playerid)) == 511 || //Beagle GetVehicleModel(GetPlayerVehicleID(playerid)) == 497 || //Police Maverick GetVehicleModel(GetPlayerVehicleID(playerid)) == 488 || //SAN News Maverick GetVehicleModel(GetPlayerVehicleID(playerid)) == 487 || //Maverick GetVehicleModel(GetPlayerVehicleID(playerid)) == 476 || //Rustler GetVehicleModel(GetPlayerVehicleID(playerid)) == 469 || //Sparrow GetVehicleModel(GetPlayerVehicleID(playerid)) == 460 || //Skimmer GetVehicleModel(GetPlayerVehicleID(playerid)) == 447 || //Seasparrow GetVehicleModel(GetPlayerVehicleID(playerid)) == 425 || //Hunter GetVehicleModel(GetPlayerVehicleID(playerid)) == 417) //Leviathan Radšej uprednostním aby to žralo viac RAM ako kebyže má každých 5 sekúnd na 0,5 sekundy "zamrznúť" (lagnuť) server... Link to comment Share on other sites More sharing options...
Roox 1 Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 Tak tohle je pěkná kravina. RAM není vždy levnější než procesor. V případě, že máš notebook, nebo 2 sloty a jeden obsazenej 16GB RAM a potřebuješ obsadit druhej... Za to si koupíš dva procesory.. Link to comment Share on other sites More sharing options...
Guest Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 lol pongo ake by nice ? to som teraz napísal... ani som to neskúšal lebo viem na 100% že to pôjde... Tak tohle je pěkná kravina. RAM není vždy levnější než procesor. V případě, že máš notebook, nebo 2 sloty a jeden obsazenej 16GB RAM a potřebuješ obsadit druhej... Za to si koupíš dva procesory.. ale kto by na ntb hosťoval server ? Link to comment Share on other sites More sharing options...
Roox 1 Odesláno: 7. Říjen, 2011 Share Odesláno: 7. Říjen, 2011 Já, protože jinej hosting nemám no Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now