if(strcmp(cmdtext, \"/minigun\", true) == 0){ new pname[MAX_PLAYER_NAME];GetPlayerName(playerid, pname, MAX_PLAYER_NAME);SendClientMessage(playerid,0xFF0505FF,\"Mivel megpróbáltál minigunt lehívni,ezért kickelve lettél a szeróról.\");Kick(playerid);format(string, sizeof(string), \"%s-t kickelte a rendszer.(Minigun lehívása miatt), pname\");SendClientMessageToAll(0xFFA205FF, string);return 1;}
if(strcmp(cmdtext, \"/dive\", true) == 0){if(IsPlayerInAnyVehicle(playerid)) { GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z); SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z + 5000);} else {SendClientMessage(playerid,COLOR_RED,\"Nem vagy jármûben\");}return 1;}
if(strcmp(cmdtext, \"/lc\", true) == 0){ SetPlayerPos(playerid,-791.5777,498.9546,1381.6057); new pname[MAX_PLAYER_NAME];GetPlayerName(playerid, pname, MAX_PLAYER_NAME);format(string, sizeof(string), \"SERVER: %s(id:%d) Elment Liberty City-be.(/lc)\", pname);SendClientMessageToAll(0x67E2E7FF, string);GameTextForPlayer(playerid,\"~b~Liberty ~w~City\",4000,5);SetPlayerInterior(playerid,1);return 1;}
if(strcmp(cmdtext, \"/vizivilag\", true) == 0){ if( IsPlayerInAnyVehicle( playerid ) ){SetVehiclePos( GetPlayerVehicleID( playerid ),-135.2784,406.0608,-40.9290);} else { SetPlayerPos(playerid,-135.2784,406.0608,-40.9290);}return 1;}
Az elsõ hibás, mivel nem a játékos nevét fogja kiírni, hanem azt, hogy \'%s ...\". Mivel nem kérted le a nevét ( GetPlayerName függvény ).ZeRo
if(strcmp(cmdtext, \"/kill\",true)==0){SetPlayerHealth(playerid, 0.00);SetPlayerInterior(playerid, 0);return 1;}
Az elsõ hibás, mivel nem a játékos nevét fogja kiírni, hanem azt, hogy \'%s ...\". Mivel nem kérted le a nevét ( GetPlayerName függvény ).ZeRo Igaz,nemteszteltem. Javítottam(mondjuk mostse teszteltem xD),de remélem most már jó. [/quote]Már majdnem. De meg kell formázni az üzenetet ( a format ( ) függvénnyel ), és azt kiírni mindenkinek. ZeRo
if ( strcmp ( cmdtext, \"/dive\", true ) == 0 ) {new Float:X, Float:Y, Float:Z;GetPlayerPos ( playerid, Float:X, Float:Y, Float:Z );SetPlayerPos ( playerid, Float:X, Float:Y, Float:Z +400 );GivePlayerWeapon(playerid, 46, 1 );return 1;}
if (strcmp(\"/detach\", cmdtext, true) == 0){if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER){ new vehicleid = GetPlayerVehicleID(playerid); if (IsTrailerAttachedToVehicle(vehicleid)) { AttachTrailerToVehicle(GetVehicleTrailer(vehicleid), vehicleid); DetachTrailerFromVehicle(vehicleid); SendClientMessage(playerid, COLOR_BASIC, \"Vlecska lekapcsolva.\"); PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0); return 1; } SendClientMessage(playerid, COLOR_RED, \"Nincs vlecska a jármûveden.\"); return 1;}SendClientMessage(playerid, COLOR_RED, \"Jármûben kell lennen hogy lecsatolhazsd a vlecskát.\");return 1;}
public OnPlayerCommandText(playerid, cmdtext[]){new string[256];new sendername[MAX_PLAYER_NAME];new giveplayer[MAX_PLAYER_NAME];new cmd[256];new giveplayerid, idx; if(strcmp(cmd, \"/kick\", true) == 0) } new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, \"HASZNÁLAT:/kick[id]\"); return 1; } giveplayerid = strval(tmp); if (IsPlayerConnected(giveplayerid)) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), \"%s kickelte %s-t a szerverrõl.\",sendername, giveplayer); SendClientMessageToAll(COLOR_YELLOW, string); Kick(giveplayerid);}else { format(string, sizeof(string), \"%d nem aktív játékos.\", giveplayerid); SendClientMessage(playerid, COLOR_YELLOW, string); }return 1;}
strtok(const string[], &index){new length = strlen(string);while ((index < length) && (string[index] <= \' \')){index++;}new offset = index;new result[20];while ((index < length) && (string[index] > \' \') && ((index - offset) < (sizeof(result) - 1))){result[index - offset] = string[index];index++;}result[index - offset] = EOS;return result;}
if (!strcmp(\"/spawn\", cmdtext, true ) ) return SpawnPlayer(playerid);
new string[256];new sendername[MAX_PLAYER_NAME];new giveplayer[MAX_PLAYER_NAME];new cmd[256];new giveplayerid, idx; new tmp[256];tmp = strtok(cmdtext, idx);cmd = strtok(cmdtext, idx); giveplayerid = strval(tmp);if(strcmp(cmd, \"/pm\", true) == 0) {if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_0xFFFF00AA, \"HASZNÁLAT: /pm [pID]\"); return 1;}if (IsPlayerConnected(giveplayerid)) {GetPlayerName(playerid, sendername, sizeof(sendername));GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));format(string, sizeof(string), \"PM %s-tõl: %s\",sendername, text);SendClientMessage(giveplayerid, COLOR_YELLOW, string);} else {SendClientMessage(playerid,0xAA3333AA,\"Nincs ilyen játékos!\");}return 1;}
dcmd_3dtext(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid)) { if(!strlen(params)) return SendClientMessage(playerid,red,\"Használat: /3dtext <szöveg>\"); new Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z); return playertextid = Create3DTextLabel(params,0x008080FF,x,y,z,40.0,0); Update3DTextLabelText(Text3D:0,0x008080FF,params); } else return SendClientMessage(playerid,red,\"HIBA: Ehez a parancshoz legalább 2-es szintû adminnak kéne lenned!\");}
if(strcmp(cmd,\"/giveweapon\",true) == 0) {tmp = strtok(cmdtext, idx);if(!strlen(tmp)) {SendClientMessage(playerid,COLOR_RED,\"HASZNÁLAT: /giveweapon <ID>\");return 1;}giveplayerid = strval(tmp);new pweapon;new pammo;if(IsPlayerConnected(giveplayerid)) {GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));GetPlayerName(playerid, sendername, sizeof(sendername));pammo = GetPlayerAmmo(playerid);pweapon = GetPlayerWeapon(playerid);GetPlayerAmmo(playerid);GivePlayerWeapon(playerid,pweapon,(0 - (pammo)));GivePlayerWeapon(giveplayerid,pweapon,pammo);format(string, sizeof(string),\"Egy fegyvert kaptál %s-tól!\",sendername);SendClientMessage(giveplayerid,COLOR_GREEN, string);format(string,sizeof(string),\"Egy fegyvert adtál %s-nak!\",giveplayer);SendClientMessage(playerid,COLOR_GREEN,string);} else {SendClientMessage(playerid,COLOR_RED,\"Nem aktív játékos!\");}return 1;}
Fegyver átadó parancs másik játékosnak. if(strcmp(cmd,\"/giveweapon\",true) == 0) {tmp = strtok(cmdtext, idx);if(!strlen(tmp)) {SendClientMessage(playerid,COLOR_RED,\"HASZNÁLAT: /giveweapon <ID>\");return 1;}giveplayerid = strval(tmp);new pweapon;new pammo;if(IsPlayerConnected(giveplayerid)) {GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));GetPlayerName(playerid, sendername, sizeof(sendername));pammo = GetPlayerAmmo(playerid);pweapon = GetPlayerWeapon(playerid);GetPlayerAmmo(playerid);GivePlayerWeapon(playerid,pweapon,(0 - (pammo)));GivePlayerWeapon(giveplayerid,pweapon,pammo);format(string, sizeof(string),\"Egy fegyvert kaptál %s-tól!\",sendername);SendClientMessage(giveplayerid,COLOR_GREEN, string);format(string,sizeof(string),\"Egy fegyvert adtál %s-nak!\",giveplayer);SendClientMessage(playerid,COLOR_GREEN,string);} else {SendClientMessage(playerid,COLOR_RED,\"Nem aktív játékos!\");}return 1;}