if(strcmp(cmd, \"/goto\", true) == 0){ if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTBLUE, \"Teszt Rpg: /goto [JátékosID/NévRészlet]\"); return 1; } new Float:plocx,Float:plocy,Float:plocz; new plo; plo = ReturnUser(tmp); if (IsPlayerConnected(plo)) { if(plo != INVALID_PLAYER_ID) { if(strcmp(nev, \"//ide a nevet\", true) == 0 || strcmp(nev, \"//ide a nevet\", true) == 0 || strcmp(nev, \"//ide a nevet\", true) == 0) { if(Spectate[playerid] != 255) { Spectate[playerid] = 256; } GetPlayerPos(plo, plocx, plocy, plocz); SetPlayerInterior(playerid,GetPlayerInterior(plo)); SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(plo)); if(PlayerInfo[plo][pInt] > 0) { SetPlayerInterior(playerid,PlayerInfo[plo][pInt]); PlayerInfo[playerid][pInt] = PlayerInfo[plo][pInt]; PlayerInfo[playerid][pLocal] = PlayerInfo[plo][pLocal]; } if(PlayerInfo[playerid][pInt] == 0) { SetPlayerInterior(playerid,0); } if(plocz > 530.0 && PlayerInfo[plo][pInt] == 0) //the highest land point in sa = 526.8 { SetPlayerInterior(playerid,1); PlayerInfo[playerid][pInt] = 1; } if (GetPlayerState(playerid) == 2) { new tmpcar = GetPlayerVehicleID(playerid); SetVehiclePos(tmpcar, plocx, plocy+4, plocz); TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0; } else { SetPlayerPos(playerid,plocx,plocy+2, plocz); } SendClientMessage(playerid, COLOR_GRAD1, \"Elteleportáltál valakihez.\"); new nev[32]; GetPlayerName(playerid, nev, sizeof(nev)); new h,mi,s,y,m,d; getdate(y,m,d); gettime(h,mi,s); format(stringx,sizeof(stringx), \"[%d/%d/%d][%d:%d:%d][Admin parancs] %s elteleportált valakihez.\",y,m,d,h,mi,s,nev); LoOoG(stringx); } else { SendClientMessage(playerid, COLOR_GRAD1, \"Nem vagy admin/adminsegéd!\"); } } } else { format(string, sizeof(string), \"%d Nem aktív játékos!\", plo); SendClientMessage(playerid, COLOR_GRAD1, string); }}return 1;}
CMD:goto(playerid, params[]) {if(IsPlayerConnected(playerid)){tmp = strtok(cmdtext, idx);if(!strlen(tmp)){SendClientMessage(playerid, COLOR_LIGHTBLUE, \"Teszt Rpg: /goto [JátékosID/NévRészlet]\");return 1;}new Float:plocx,Float:plocy,Float:plocz;new plo;plo = ReturnUser(tmp);if (IsPlayerConnected(plo)){if(plo != INVALID_PLAYER_ID){if(strcmp(nev, \"//ide a nevet\", true) == 0 || strcmp(nev, \"//ide a nevet\", true) == 0 || strcmp(nev, \"//ide a nevet\", true) == 0){if(Spectate[playerid] != 255){Spectate[playerid] = 256;}GetPlayerPos(plo, plocx, plocy, plocz);SetPlayerInterior(playerid,GetPlayerInterior(plo));SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(plo));if(PlayerInfo[plo][pInt] > 0){SetPlayerInterior(playerid,PlayerInfo[plo][pInt]);PlayerInfo[playerid][pInt] = PlayerInfo[plo][pInt];PlayerInfo[playerid][pLocal] = PlayerInfo[plo][pLocal];}if(PlayerInfo[playerid][pInt] == 0){SetPlayerInterior(playerid,0);}if(plocz > 530.0 && PlayerInfo[plo][pInt] == 0) //the highest land point in sa = 526.8{SetPlayerInterior(playerid,1);PlayerInfo[playerid][pInt] = 1;}if (GetPlayerState(playerid) == 2){new tmpcar = GetPlayerVehicleID(playerid);SetVehiclePos(tmpcar, plocx, plocy+4, plocz);TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;}else{SetPlayerPos(playerid,plocx,plocy+2, plocz);}SendClientMessage(playerid, COLOR_GRAD1, \"Elteleportáltál valakihez.\");new nev[32];GetPlayerName(playerid, nev, sizeof(nev));new h,mi,s,y,m,d;getdate(y,m,d);gettime(h,mi,s);format(stringx,sizeof(stringx), \"[%d/%d/%d][%d:%d:%d][Admin parancs] %s elteleportált valakihez.\",y,m,d,h,mi,s,nev);LoOoG(stringx);}else{SendClientMessage(playerid, COLOR_GRAD1, \"Nem vagy admin/adminsegéd!\");}}}else{format(string, sizeof(string), \"%d Nem aktív játékos!\", plo);SendClientMessage(playerid, COLOR_GRAD1, string);}}return 1;}
if(strcmp(cmd, \"/get\", true) == 0){ if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTBLUE, \"Game Life Rpg: /get [JátékosID/NévRészlet]\"); return 1; } new Float:plocx,Float:plocy,Float:plocz; new plo; plo = ReturnUser(tmp); if (IsPlayerConnected(plo)) { if(plo != INVALID_PLAYER_ID) { /*if (PlayerInfo[plo][pAdmin] > 1) { SendClientMessage(playerid, COLOR_GRAD1, \"Admint nem hozhatsz magadhoz!\"); return 1; }*/ if(strcmp(nev, \"//ide a nevet\", true) == 0 || strcmp(nev, \"//ide a nevet\", true) == 0 || strcmp(nev, \"//ide a nevet\", true) == 0) { GetPlayerPos(playerid, plocx, plocy, plocz); if(PlayerInfo[playerid][pInt] > 0) { SetPlayerInterior(plo,PlayerInfo[playerid][pInt]); PlayerInfo[plo][pInt] = PlayerInfo[playerid][pInt]; PlayerInfo[plo][pLocal] = PlayerInfo[playerid][pLocal]; } if(PlayerInfo[playerid][pInt] == 0) { SetPlayerInterior(plo,0); } if(plocz > 930.0 && PlayerInfo[playerid][pInt] == 0) //the highest land point in sa = 526.8 { SetPlayerInterior(plo,1); PlayerInfo[plo][pInt] = 1; } if (GetPlayerState(plo) == 2) { TelePos[plo][0] = 0.0; TelePos[plo][1] = 0.0; new tmpcar = GetPlayerVehicleID(plo); SetVehiclePos(tmpcar, plocx, plocy+4, plocz); } else { SetPlayerPos(plo,plocx,plocy+2, plocz); } SendClientMessage(playerid, COLOR_GRAD1, \"Idehoztál valakit magadhoz.\"); SendClientMessage(plo, COLOR_GRAD1, \"Elteleportáltak.\"); new nev[32]; GetPlayerName(playerid, nev, sizeof(nev)); new h,mi,s,y,m,d; getdate(y,m,d); gettime(h,mi,s); format(stringx,sizeof(stringx), \"[%d/%d/%d][%d:%d:%d][Admin parancs] %s gettelt magához valakit.\",y,m,d,h,mi,s,nev); LoOoG(stringx); } else { SendClientMessage(playerid, COLOR_GRAD2, \"Nem használhatod ezt a parancsot!\"); } } } else { format(string, sizeof(string), \"%d Nem aktív játékos!\", plo); SendClientMessage(playerid, COLOR_GRAD2, string); }}return 1;}
CMD:get(playerid, params[]) {if(IsPlayerConnected(playerid)){tmp = strtok(cmdtext, idx);if(!strlen(tmp)){SendClientMessage(playerid, COLOR_LIGHTBLUE, \"Game Life Rpg: /get [JátékosID/NévRészlet]\");return 1;}new Float:plocx,Float:plocy,Float:plocz;new plo;plo = ReturnUser(tmp);if (IsPlayerConnected(plo)){if(plo != INVALID_PLAYER_ID){/*if (PlayerInfo[plo][pAdmin] > 1){SendClientMessage(playerid, COLOR_GRAD1, \"Admint nem hozhatsz magadhoz!\");return 1;}*/if(strcmp(nev, \"//ide a nevet\", true) == 0 || strcmp(nev, \"//ide a nevet\", true) == 0 || strcmp(nev, \"//ide a nevet\", true) == 0){GetPlayerPos(playerid, plocx, plocy, plocz);if(PlayerInfo[playerid][pInt] > 0){SetPlayerInterior(plo,PlayerInfo[playerid][pInt]);PlayerInfo[plo][pInt] = PlayerInfo[playerid][pInt];PlayerInfo[plo][pLocal] = PlayerInfo[playerid][pLocal];}if(PlayerInfo[playerid][pInt] == 0){SetPlayerInterior(plo,0);}if(plocz > 930.0 && PlayerInfo[playerid][pInt] == 0) //the highest land point in sa = 526.8{SetPlayerInterior(plo,1);PlayerInfo[plo][pInt] = 1;}if (GetPlayerState(plo) == 2){TelePos[plo][0] = 0.0;TelePos[plo][1] = 0.0;new tmpcar = GetPlayerVehicleID(plo);SetVehiclePos(tmpcar, plocx, plocy+4, plocz);}else{SetPlayerPos(plo,plocx,plocy+2, plocz);}SendClientMessage(playerid, COLOR_GRAD1, \"Idehoztál valakit magadhoz.\");SendClientMessage(plo, COLOR_GRAD1, \"Elteleportáltak.\");new nev[32];GetPlayerName(playerid, nev, sizeof(nev));new h,mi,s,y,m,d;getdate(y,m,d);gettime(h,mi,s);format(stringx,sizeof(stringx), \"[%d/%d/%d][%d:%d:%d][Admin parancs] %s gettelt magához valakit.\",y,m,d,h,mi,s,nev);LoOoG(stringx);}else{SendClientMessage(playerid, COLOR_GRAD2, \"Nem vagy 2-es Admin!\");}}}else{format(string, sizeof(string), \"%d Nem aktív játékos!\", plo);SendClientMessage(playerid, COLOR_GRAD2, string);}}return 1;}
CMD:goto(playerid, params[]){ if(!strcmp(pName(playerid), \"ide a nevet\", true)) { new player; if(sscanf(params, \"u\", player)) return SendClientMessage(playerid, -1, \"/goto [játékos]\"); if(!IsPlayerConnected(player)) return 1; // nincs csatlakozva a megadott játékos new Float:pos[3]; GetPlayerPos(player, pos[0], pos[1], pos[2]); SetPlayerInterior(playerid, GetPlayerInterior(player)); SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(player)); SetPlayerPos(playerid, pos[0], pos[1], pos[2]); return 1; } SendClientMessage(playerid, -1, \"Ezt a parancsot csak xy használhatja!\"); return 1;}CMD:get(playerid, params[]){ if(!strcmp(pName(playerid), \"ide a nevet\", true)) { new player; if(sscanf(params, \"u\", player)) return SendClientMessage(playerid, -1, \"/get [játékos]\"); if(!IsPlayerConnected(player)) return 1; // nincs csatlakozva a megadott játékos new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); SetPlayerInterior(player, GetPlayerInterior(playerid)); SetPlayerVirtualWorld(player, GetPlayerVirtualWorld(playerid)); SetPlayerPos(player, pos[0], pos[1], pos[2]); return 1; } SendClientMessage(playerid, -1, \"Ezt a parancsot csak xy használhatja!\"); return 1;}
stock pName(playerid){ new n[24]; GetPlayerName(playerid, n, 24); return n;}
if(!strlen(tmp)){SendClientMessage(playerid, COLOR_LIGHTBLUE, \"Game Life Rpg: /get [JátékosID/NévRészlet]\");return 1;}[/quote]És gondolom nem arra gondolt a témanyitó, hogy egy sort írj át, hanem hogy alakítsd át a paraméterezését is.#include <a_samp>#include <zcmd>#include <sscanf2>#define nev \"Karcsi23\" //Csak õ jogosult a parancs használatárastock Compare(comp[], with[]) //by dexi: http://sampforum.hu/index.php?topic=23578.msg247872#msg247872{new LenghtComp = strlen(comp);new LenghtWith = strlen(with);new Character;if( LenghtComp != LenghtWith ) return false;for( new i = 0; i < LenghtComp; i++ ) if( comp == with ) Character++;if( LenghtComp == Character ) return true;return false;}CMD:goto(playerid,params[]) {new n[24]; GetPlayerName(playerid,n,24);if(!Compare(nev,n)) SendClientMessage(playerid,-1,\"Ezt a parancsot csak \"nev\" használhatja!\");new id;if(sscanf(params,\"u\",id)) return SendClientMessage(playerid,-1,\"Használat: /get [Playerid]\");new Float:x,Float:y,Float:z;GetPlayerPos(id,x,y,z);SetPlayerPos(playerid,x,y,z);return 1;}CMD:get(playerid,params[]) {new n[24]; GetPlayerName(playerid,n,24);if(!Compare(nev,n)) SendClientMessage(playerid,-1,\"Ezt a parancsot csak \"nev\" használhatja!\");new id;if(sscanf(params,\"u\",id)) return SendClientMessage(playerid,-1,\"Használat: /get [Playerid]\");new Float:x,Float:y,Float:z;GetPlayerPos(playerid,x,y,z);SetPlayerPos(id,x,y,z);return 1;}
#include <a_samp>#include <zcmd>#include <sscanf2>#define nev \"Karcsi23\" //Csak õ jogosult a parancs használatárastock Compare(comp[], with[]) //by dexi: http://sampforum.hu/index.php?topic=23578.msg247872#msg247872{new LenghtComp = strlen(comp);new LenghtWith = strlen(with);new Character;if( LenghtComp != LenghtWith ) return false;for( new i = 0; i < LenghtComp; i++ ) if( comp == with ) Character++;if( LenghtComp == Character ) return true;return false;}CMD:goto(playerid,params[]) {new n[24]; GetPlayerName(playerid,n,24);if(!Compare(nev,n)) SendClientMessage(playerid,-1,\"Ezt a parancsot csak \"nev\" használhatja!\");new id;if(sscanf(params,\"u\",id)) return SendClientMessage(playerid,-1,\"Használat: /get [Playerid]\");new Float:x,Float:y,Float:z;GetPlayerPos(id,x,y,z);SetPlayerPos(playerid,x,y,z);return 1;}CMD:get(playerid,params[]) {new n[24]; GetPlayerName(playerid,n,24);if(!Compare(nev,n)) SendClientMessage(playerid,-1,\"Ezt a parancsot csak \"nev\" használhatja!\");new id;if(sscanf(params,\"u\",id)) return SendClientMessage(playerid,-1,\"Használat: /get [Playerid]\");new Float:x,Float:y,Float:z;GetPlayerPos(playerid,x,y,z);SetPlayerPos(id,x,y,z);return 1;}