Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, 0xFF0000FF, "[INFO] Je kan dat commando slechts om de seconde gebruiken");
return 1;
}
iPlayerChatTime[playerid] = GetTickCount();
new cmd[256];
new tmp[256];
new Message[256];
new gMessage[256];
new pName[MAX_PLAYER_NAME+1];
new iName[MAX_PLAYER_NAME+1];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp("/pm", cmd, true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5) {
SendClientMessage(playerid,ADMIN,"[INFO] /pm [id] [bericht]");
return 1;
}
new id = strval(tmp);
gMessage = strrest(cmdtext,idx);
if(!strlen(gMessage)) {
SendClientMessage(playerid,ADMIN,"[INFO] /pm [id] [bericht]");
return 1;
}
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,ADMIN,"[INFO] Player id klopt niet");
}
if(playerid != id) {
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
SendClientMessage(playerid,PM_OUT,Message);
format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
SendClientMessage(id,PM_IN,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("[PM] %s",Message);
}
else {
SendClientMessage(playerid,ADMIN,"[INFO] Je kan jezelf geen pm's sturen");
}
return 1;
}
if(strcmp("/kick", cmd, true) == 0)
{
if(IsPlayerAdmin(playerid)) {
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5) {
return SendClientMessage(playerid,ADMIN,"[INFO] /kick [id] [reden]");
}
new id = strval(tmp);
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,ADMIN,"[INFO] Player id klopt niet");
return 1;
}
gMessage = strrest(cmdtext,idx);
GetPlayerName(id,iName,sizeof(iName));
SendClientMessage(id,ADMIN,">> Je bent gekickt van deze server.");
if(strlen(gMessage) > 0) {
format(Message,sizeof(Message),"[INFO] Reden %s",gMessage);
SendClientMessage(id,ADMIN,Message);
}
format(Message,sizeof(Message),"[INFO] %s(%d) is gekickt",iName,id);
SendClientMessage(playerid,ADMIN,Message);
Kick(id);
return 1;
} else {
SendClientMessage(playerid,ADMIN,"[INFO] /rcon login [password]");
return 1;
}
}
if(strcmp("/ban", cmd, true) == 0)
{
if(IsPlayerAdmin(playerid)) {
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5) {
return SendClientMessage(playerid,ADMIN,"[INFO] /ban [id] [reden]");
}
new id = strval(tmp);
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,ADMIN,"[INFO] playerid klopt niet");
return 1;
}
gMessage = strrest(cmdtext,idx);
GetPlayerName(id,iName,sizeof(iName));
SendClientMessage(id,ADMIN,">> Je bent gebant van deze server.");
if(strlen(gMessage) > 0) {
format(Message,sizeof(Message),"[INFO] Reden: %s",gMessage);
SendClientMessage(id,ADMIN,Message);
}
format(Message,sizeof(Message),"[INFO] %s(%d) is verbannen",iName,id);
SendClientMessage(playerid,ADMIN,Message);
Ban(id);
return 1;
} else {
SendClientMessage(playerid,ADMIN,"[INFO] /rcon login [password]");
return 1;
}
}
//----------------------------------------------------------
if (strcmp("/start", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}Welkom!");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}Dit is een freeroam server.");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}Dat je kan doen wat je wilt.");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}De basis commando's zijn:");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF} /help /cmd /commands /rules /kitinfo");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF} /register /login /stats");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF} /v /t /h /a /kill");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF} /kit1 /kit2 /kit3 /kit4 /kit5 /kit6");
return 1;
}
if (strcmp(cmdtext, "/spawn", true) == 0)
{
SpawnPlayer(playerid);
return 1;
}
if (strcmp("/help", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}Welkom bij {1AB109}G{FFFFFF}r{FF0000}a{FFFFFF}n{1AB109}d {1AB109}L{FFFFFF}a{FF0000}r{FFFFFF}c{1AB109}e{FFFFFF}n{FF0000}y");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/start voor meer info");
return 1;
}
if (strcmp("/cmd", cmdtext, true, 5) == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Commandos", "/start\n/help\n/spawn\n/cmd\n/kitinfo\n/h\n/a", "Ok", "Cancel");
return 1;
}
if (strcmp("/weer", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}Weersomstandigheden:");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/w1: storm");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/w2: mistig");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/w3: heet (warmte golven)");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/w4: zandstorm");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/w5: grijsachtig");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/w6: regenachtig");
return 1;
}
if (strcmp("/tijd", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}Tijden");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/ochtent (06:00)");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/middag (12:00)");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/nacht (23:00)");
return 1;
}
if (strcmp("/zwaartekrach", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}Zwaartekracht:");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/z1(+)= 0.004 = Weinig tot geen");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/z2 = 0.008 = Standaart");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO] {FFFFFF}/z1(+) = 0.012 = Meer");
return 1;
}
if (strcmp("/rules", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[REGELS]{FFFFFF} 1) Regels:");
SendClientMessage(playerid, COLOR_MGREEN, "[REGELS]{FFFFFF} 2) Spawnkilling toegestaan.");
SendClientMessage(playerid, COLOR_MGREEN, "[REGELS]{FFFFFF} 3) Cleo cheats/mods niet");
SendClientMessage(playerid, COLOR_MGREEN, "[REGELS]{FFFFFF} 4) Meerdere acounts is niet teogestaan.");
SendClientMessage(playerid, COLOR_MGREEN, "[REGELS]{FFFFFF} 5) Schelden, flooten, spammen en snele herhaling van teksten is ook niet toegestaan.");
return 1;
}
//----------------------------------------------------------
if (strcmp("/kitinfo", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} Aantal kits beschikbaar: 6");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} /kit1: Baseball Bat, Silenced 9mm, Combat Shotgun, MP5");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} /kit2: Brass Knuckles, Katana, Molotov Cocktail, Micro SMG");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} /kit3: Knife, Silenced 9mm, Silenced 9mm, Combat Shotgun, MP5, M4, Sniper Rifle");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} Rocket Launcher, Satchel Charge, Detonator, Camera, Parachute");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} /kit4: empty!");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} /kit5: empty!");
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} /kit6: empty!");
return 1;
}
if (strcmp("/kit", cmdtext, true, 5) == 0)
{
ShowPlayerDialog(playerid,510,DIALOG_STYLE_LIST,"Server Control:","Standaart kit [$10000]\nAsian Kit [$30000]\nHeavy Weapons Kit [$70000]\nKit4 [$10000]\nKit5 [$10000]\nKit6 [$10000]","Kies","Annuleren");
return 1;
}
ShowPlayerDialog(playerid,500,DIALOG_STYLE_LIST,"Server Control:","Tijd\nWeer\nZwaartekracht\nSkins\nGeld\nSpeler Marker\nServer Herstarten\nSever Afsluiten","Kies","Annuleren");
if (strcmp("/kit1", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[KIT1]{FFFFFF} Standaart kit:");
SendClientMessage(playerid, COLOR_MGREEN, "[KIT1]{FFFFFF} Baseball Bat, Silenced 9mm, Combat Shotgun, MP5");
GivePlayerWeapon(playerid, 0, 1);
GivePlayerWeapon(playerid, 5, 1);
GivePlayerWeapon(playerid, 23, 1000);
GivePlayerWeapon(playerid, 27, 1000);
GivePlayerWeapon(playerid, 29, 1000);
return 1;
}
if (strcmp("/kit2", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[KIT2]{FFFFFF} Asian kit:");
SendClientMessage(playerid, COLOR_MGREEN, "[KIT2]{FFFFFF} Brass Knuckles, Katana, Molotov Cocktail, Micro SMG");
GivePlayerWeapon(playerid, 1, 1);
GivePlayerWeapon(playerid, 8, 1);
GivePlayerWeapon(playerid, 18, 1000);
GivePlayerWeapon(playerid, 28, 1000);
return 1;
}
if (strcmp("/kit3", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[KIT3]{FFFFFF} Heavy Weapons kit:");
SendClientMessage(playerid, COLOR_MGREEN, "[KIT3]{FFFFFF} Knife, Silenced 9mm, Silenced 9mm, Combat Shotgun, MP5, M4, Sniper Rifle,");
SendClientMessage(playerid, COLOR_MGREEN, "[KIT3]{FFFFFF} Rocket Launcher, Satchel Charge, Detonator, Camera, Parachute");
GivePlayerWeapon(playerid, 0, 1);
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 23, 1000);
GivePlayerWeapon(playerid, 27, 1000);
GivePlayerWeapon(playerid, 29, 1000);
GivePlayerWeapon(playerid, 31, 1000);
GivePlayerWeapon(playerid, 34, 1000);
GivePlayerWeapon(playerid, 35, 1000);
GivePlayerWeapon(playerid, 39, 1000);
GivePlayerWeapon(playerid, 40, 1000);
GivePlayerWeapon(playerid, 43, 1000);
GivePlayerWeapon(playerid, 46, 1000);
return 1;
}
if (strcmp("/kit4", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[KIT]{FFFFFF} empty!");
return 1;
}
if (strcmp("/kit5", cmdtext, true, 5) == 0)
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, COLOR_MGREEN, "[KIT]{FFFFFF} empty!");
return 1;
}
if (strcmp("/kit6", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid, COLOR_MGREEN, "[KIT]{FFFFFF} empty!");
return 1;
}
//----------------------------------------------------------
if (strcmp("/h", cmdtext, true, 5) == 0)
{
SetPlayerHealth(playerid, 100);
GivePlayerMoney(playerid, -15000);
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} Je bent gehealt.");
GivePlayerMoney(playerid, -1000);
return 1;
}
if (strcmp("/a", cmdtext, true, 5) == 0)
{
SetPlayerArmour(playerid, 1000);
GivePlayerMoney(playerid, -10000);
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} Je hebt amour gekregen.");
return 1;
}
if (strcmp("/p", cmdtext, true, 5) == 0)
{
GivePlayerWeapon(playerid, 46, 1);
GivePlayerMoney(playerid, -1000);
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} Je hebt parachute gekregen.");
return 1;
}
if (strcmp("/kill", cmdtext, true, 5) == 0)
{
SetPlayerHealth(playerid, 0);
SetPlayerArmour(playerid, 0);
GivePlayerMoney(playerid, -100);
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} Je hebt jezelf gedoodt.");
return 1;
}
if (strcmp("/+money", cmdtext, true, 5) == 0)
{
GivePlayerMoney(playerid, 100000);
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} +$100000");
return 1;
}
if (strcmp("/-money", cmdtext, true, 5) == 0)
{
GivePlayerMoney(playerid, -100000);
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} -$100000");
return 1;
}
//----------------------------------------------------------
if(strcmp(cmdtext, "/s1", true) == 0)
{
SetPlayerSkin(playerid, 163);
return 1;
}
if(strcmp(cmdtext, "/s2", true) == 0)
{
SetPlayerSkin(playerid, 166);
return 1;
}
if(strcmp(cmdtext, "/s3", true) == 0)
{
SetPlayerSkin(playerid, 164);
return 1;
}
if(strcmp(cmdtext, "/s4", true) == 0)
{
SetPlayerSkin(playerid, 165);
return 1;
}
if(strcmp(cmdtext, "/s5", true) == 0)
{
SetPlayerSkin(playerid, 227);
return 1;
}
if(strcmp(cmdtext, "/s6", true) == 0)
{
SetPlayerSkin(playerid, 255);
return 1;
}
if(strcmp(cmdtext, "/s7", true) == 0)
{
SetPlayerSkin(playerid, 228);
return 1;
}
if(strcmp(cmdtext, "/s8", true) == 0)
{
SetPlayerSkin(playerid, 17);
return 1;
}
if(strcmp(cmdtext, "/s9", true) == 0)
{
SetPlayerSkin(playerid, 57);
return 1;
}
if(strcmp(cmdtext, "/s10", true) == 0)
{
SetPlayerSkin(playerid, 252);
return 1;
}
//----------------------------------------------------------
if(strcmp(cmdtext, "/w1", true) == 0)
{
SetPlayerWeather(playerid, 08);
SendClientMessageToAll(COLOR_MBLUE, "[WEER]{FFFFFF} Storm");
return 1;
}
if(strcmp(cmdtext, "/w2", true) == 0)
{
SetPlayerWeather(playerid, 09);
SendClientMessageToAll(COLOR_MBLUE, "[WEER]{FFFFFF} Mistig");
return 1;
}
if(strcmp(cmdtext, "/w3", true) == 0)
{
SetPlayerWeather(playerid, 11);
SendClientMessageToAll(COLOR_MBLUE, "[WEER]{FFFFFF} Heet (Warmte Golven)");
return 1;
}
if(strcmp(cmdtext, "/w4", true) == 0)
{
SetPlayerWeather(playerid, 19);
SendClientMessageToAll(COLOR_MBLUE, "[WEER]{FFFFFF} Zandstorm");
return 1;
}
if(strcmp(cmdtext, "/w5", true) == 0)
{
SetPlayerWeather(playerid, 15);
SendClientMessageToAll(COLOR_MBLUE, "[WEER]{FFFFFF} Grijsachtig");
return 1;
}
if(strcmp(cmdtext, "/w6", true) == 0)
{
SetPlayerWeather(playerid, 16);
SendClientMessageToAll(COLOR_MBLUE, "[WEER]{FFFFFF} Regen");
return 1;
}
//----------------------------------------------------------
if(strcmp(cmdtext, "/ochtent", true) == 0)
{
SetWorldTime(6);
SendClientMessageToAll(COLOR_MBLUE, "[TIJD]{FFFFFF} Ochtend (06:00)");
return 1;
}
if(strcmp(cmdtext, "/middag", true) == 0)
{
SetWorldTime(12);
SendClientMessageToAll(COLOR_MBLUE, "[WEER]{FFFFFF} Middag (12:00)");
return 1;
}
if(strcmp(cmdtext, "/nacht", true) == 0)
{
SetWorldTime(23);
SendClientMessageToAll(COLOR_MBLUE, "[TIJD]{FFFFFF} Nacht (23:00)");
return 1;
}
//----------------------------------------------------------
if(strcmp(cmdtext, "/z1", true) == 0)
{
SetGravity(0.004);
SendClientMessageToAll(COLOR_MBLUE, "[ZK]{FFFFFF} Zwaartekrach: 0.004");
return 1;
}
if(strcmp(cmdtext, "/z1+", true) == 0)
{
SetGravity(-0.00);
SendClientMessageToAll(COLOR_MBLUE, "[ZK]{FFFFFF} Zwaartekrach: -0.00");
return 1;
}
if(strcmp(cmdtext, "/z1++", true) == 0)
{
SetGravity(-0.004);
SendClientMessageToAll(COLOR_MBLUE, "[ZK]{FFFFFF} Zwaartekrach: -0.004");
return 1;
}
if(strcmp(cmdtext, "/z2", true) == 0)
{
SetGravity(0.008);
SendClientMessageToAll(COLOR_MBLUE, "[ZK]{FFFFFF} Zwaartekrach: 0.008");
return 1;
}
if(strcmp(cmdtext, "/z3", true) == 0)
{
SetGravity(0.012);
SendClientMessageToAll(COLOR_MBLUE, "[ZK]{FFFFFF} Zwaartekrach: 0.012");
return 1;
}
if(strcmp(cmdtext, "/z3+", true) == 0)
{
SetGravity(0.020);
SendClientMessageToAll(COLOR_MBLUE, "[ZK]{FFFFFF} Zwaartekrach: 0.020");
return 1;
}
if(strcmp(cmdtext, "/z3++", true) == 0)
{
SetGravity(0.035);
SendClientMessageToAll(COLOR_MBLUE, "[ZK]{FFFFFF} Zwaartekrach: 0.035");
return 1;
}
if(!strcmp(cmdtext, "/npcmenu", true))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "NPC's Online:", "Aantal NPC's online: 19", "Oke", "Sluiten");
return 1;
}
if (!strcmp("/r", cmdtext))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Je bent niet in een voertuig.");
RepairVehicle(GetPlayerVehicleID(playerid));
GivePlayerMoney(playerid, -10000);
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} Voertuig gerepareert.");
return 1;
}
if (!strcmp("/countdown", cmdtext))
{
SendClientMessageToAll(COLOR_MBLUE, "[INFO]{FFFFFF} Aftellen gestart (5 seconde)");
SetTimer("b1", 1000, false);
SetTimer("b2", 2000, false);
SetTimer("b3", 3000, false);
SetTimer("b4", 4000, false);
SetTimer("b5", 5000, false);
SetTimer("b6", 6000, false);
SetTimer("b7", 6000, false);
return 1;
}
if (strcmp("/s", cmdtext, true, 10) == 0)
{
new File:file,str[256];
file=fopen("save1.txt",io_append);
SendClientMessage(playerid, COLOR_MGREEN, "[INFO]{FFFFFF} Positie opgeslagen");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
format(str, 256,"%.3f,%.3f,%.3f",x,y,z);
fwrite(file,str);
fwrite(file,"\r\n");
fclose(file);
return 1;
}
if (strcmp("/ontzichtbaar", cmdtext, true) == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, false);
new string[64], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid,playerName,MAX_PLAYER_NAME);
format(string,sizeof string,"[INFO] {FFFFFF}%s heeft zichzelf ontzichtbaar gemaakt",playerName);
SendClientMessageToAll(COLOR_MGREEN,string);
ShowNameTags( 0 );
return 1;
}
if (strcmp("/zichtbaar", cmdtext, true) == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, true);
new string[64], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid,playerName,MAX_PLAYER_NAME);
format(string,sizeof string,"[INFO] {FFFFFF}%s heeft zichzelf zichtbaar gemaakt",playerName);
SendClientMessageToAll(COLOR_MGREEN,string);
ShowNameTags( 1 );
return 1;
}
if(strcmp(cmdtext,"/sc",true)==0)
{
ShowPlayerDialog(playerid,500,DIALOG_STYLE_LIST,"Server Control:","Tijd\nWeer\nZwaartekracht\nSkins\nGeld\nSpeler Marker\nServer Herstarten\nSever Afsluiten","Kies","Annuleren");
return 1;
}
return 0;
}