01.07.2016, 08:55
Hello!
Do it like this:
You can see how I put it in this gamemode. Next time I think you will know how you have to do it.
Do it like this:
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(login,5,cmdtext);
dcmd(setlevel, 8, cmdtext);
dcmd(ban, 3, cmdtext);
dcmd(freeze, 6, cmdtext);
dcmd(unfreeze, 8, cmdtext);
dcmd(kick, 4, cmdtext);
dcmd(sgod, 4, cmdtext);
dcmd(god, 3, cmdtext);
dcmd(explode, 7,cmdtext);
dcmd(acmds,5,cmdtext);
dcmd(akill,5,cmdtext);
dcmd(jetpack,7,cmdtext);
dcmd(disarm,6,cmdtext);
dcmd(eject,5,cmdtext);
dcmd(repair,6,cmdtext);
dcmd(spec,4,cmdtext);
dcmd(specoff,7,cmdtext);
dcmd(pm,2,cmdtext);
dcmd(cargod,6,cmdtext);
dcmd(kill,4,cmdtext);
dcmd(aheal,5,cmdtext);
dcmd(givecash,8,cmdtext);
dcmd(gc,2,cmdtext);
dcmd(admins,6,cmdtext);
dcmd(goto,4,cmdtext);
dcmd(get,3,cmdtext);
dcmd(setcash,7,cmdtext);
dcmd(setname,7,cmdtext);
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
dcmd(register,8,cmdtext);
if (strcmp("/help", cmdtext, true, 4) == 0)
{
SendClientMessage(playerid,COLOR_RED,"This is an DeathMatch gamemode.");
SendClientMessage(playerid,COLOR_RED,"Your goal is to kill other players and get score and money");
SendClientMessage(playerid,COLOR_GREEN,"Register at our website : changeme");
SendClientMessage(playerid,COLOR_BLUE,"To see list of commands use /cmds ");
return 1;
}
if (strcmp("/kill", cmdtext, true, 4) == 0)
{
SetPlayerHealth(playerid, 0);
return 1;
}
if (strcmp("/heal", cmdtext, true, 7) == 0)
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_RED, "ERROR : You dont have enough money!");
{
GivePlayerMoney(playerid, -1000);
SetPlayerHealth(playerid,100);
}
return 1;
}
if (strcmp("/cmds", cmdtext, true, 4) == 0)
{
SendClientMessage(playerid,COLOR_RED,"---------------------Commands----------------------");
SendClientMessage(playerid,COLOR_RED,"Current commands are:");
SendClientMessage(playerid,COLOR_GREEN," /kill /help /heal");
SendClientMessage(playerid,COLOR_BLUE,"/sf / lv /ls ");
return 1;
}
if (strcmp("/sf", cmdtext, true, 2) == 0)
{
SetPlayerPos(playerid,-2039.7689,135.6302,28.8359);
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, 0x00FFFFAA, "You have been teleported to San Fierro.");
return 1;
}
if (strcmp("/ls", cmdtext, true, 2) == 0)
{
SetPlayerPos(playerid,2490.6665,-1669.7076,13.3359);
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, 0x00FFFFAA, "You have been teleported to Los Santos.");
return 1;
}
if (strcmp("/lv", cmdtext, true, 2) == 0)
{
SetPlayerPos(playerid,1907.0464,960.0598,10.8203);
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, 0x00FFFFAA, "You have been teleported to Las Venturas.");
return 1;
}
if (strcmp("/RDM", cmdtext, true, 3) == 0)
{
SetPlayerPos(playerid,-1285.1356,458.6940,7.1875);
SetPlayerVirtualWorld(playerid, 1337);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 28, 99999);
GivePlayerWeapon(playerid, 26, 99999);
SendClientMessage(playerid, 0x00FFFFAA, "Welcome to Runnies DeathMatch zone.To quit use /cancel.");
return 1;
}
if (strcmp("/WDM", cmdtext, true, 3) == 0)
{
SetPlayerPos(playerid,-1285.1356,458.6940,7.1875);
SetPlayerVirtualWorld(playerid, 1338);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 99999);
GivePlayerWeapon(playerid, 27, 99999);
GivePlayerWeapon(playerid, 29, 99999);
GivePlayerWeapon(playerid, 31, 99999);
SendClientMessage(playerid, 0x00FFFFAA, "Welcome to Walkies DeathMatch zone.To quit use /cancel.");
return 1;
}
if (strcmp("/cancel", cmdtext, true, 5) == 0)
{
SetPlayerVirtualWorld(playerid, 0);
SetPlayerHealth(playerid, 0);
return 1;
}
if (strcmp("/shoot", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 1457.7526,-1062.9589,213.3828);
SendClientMessage(playerid, COLOR_RED , "Ready To Shoot!");
GivePlayerWeapon(playerid, 31, 9999);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
return 1;
}
return 0;
}