public OnPlayerCommandText(playerid, cmdtext[])
{
new command[256], index;
command = strtok(cmdtext, index);
if (strcmp(command, "/help", true) ==0)
{
SendPmMsg(playerid, "----------------------------------");
SendPmMsg(playerid, "Hello and welcome to Ali's Code Testing server!");
SendPmMsg(playerid, "This server is being used by me to learn how to code Pawn, the language");
SendPmMsg(playerid, "used to make scripts for SA-MP");
SendPmMsg(playerid, "----------------------------------");
SendPmMsg(playerid, "Type: /rules for the server rules");
SendPmMsg(playerid, " /commands for a list of commands");
SendPmMsg(playerid, "----------------------------------");
SendPmMsg(playerid, "That's it for now, but hopefully more coming soon!");
SendPmMsg(playerid, "----------------------------------");
return 1;
}
if (strcmp(command, "/rules", true) ==0)
{
SendPmMsg(playerid, "----------------------------------");
SendPmMsg(playerid, "Here is a list of all the rules in this server, don't obey");
SendPmMsg(playerid, "them and you will be punished");
SendPmMsg(playerid, "----------------------------------");
SendPmMsg(playerid, "No Deathmatching");
SendPmMsg(playerid, "No cheats or hacks of any kind");
SendPmMsg(playerid, "No offensive comments");
SendPmMsg(playerid, "Be respectful to other players");
SendPmMsg(playerid, "be respectful to admins");
SendPmMsg(playerid, "----------------------------------");
return 1;
}
if (strcmp(command, "/commands", true) ==0)
{
new commandsnum[256];
commandsnum = strtok(cmdtext, index);
if(!strlen(commandsnum))
{
SendErrMsg(playerid, "Usage: /commands <List Number>");
}
else
{
if (strval(commandsnum) == 1)
{
SendPmMsg(playerid, "----------------------------------");
SendPmMsg(playerid, "Commands List 1");
SendPmMsg(playerid, "/help - See the help menu");
SendPmMsg(playerid, "/giveweapon - Gives you or another player a weapon");
SendPmMsg(playerid, "/sethealth - Sets the health of you or another player");
SendPmMsg(playerid, "/up - raises you up by the defined distance");
SendPmMsg(playerid, "/teleport - teleports you to the specified player");
SendPmMsg(playerid, "/goto - CMoves you to a predefined location");
SendPmMsg(playerid, "/inter - to change your interior");
SendPmMsg(playerid, "Type /commands2 for the second list");
}
if (strval(commandsnum) == 2)
{
SendPmMsg(playerid, "----------------------------------");
SendPmMsg(playerid, "Commands List 2");
SendPmMsg(playerid, "/remove - removes the player from their vehicle");
SendPmMsg(playerid, "/home - brings you back to the spawnpoint");
SendPmMsg(playerid, "/disarm - to disarm a player");
SendPmMsg(playerid, "/givecash - to givecash to a player");
SendPmMsg(playerid, "/pm - send a private message to another player");
SendPmMsg(playerid, "/worldtime - to change the time of the map");
SendPmMsg(playerid, "/setcolor - to set your player color");
SendPmMsg(playerid, "Type /commands 3 for the third commands list");
}
if (strval(commandsnum) == 3)
{
SendPmMsg(playerid, "----------------------------------");
SendPmMsg(playerid, "Commands List 3");
SendPmMsg(playerid, "/admincash - to give yourself cash (Rcon admin only)");
}
}
return 1;
}
if (strcmp(command, "/up", true)==0)
{
new upnum[256];
upnum = strtok(cmdtext, index);
if(!strlen(upnum))
{
SendErrMsg(playerid, "Usage: /up <Amount to go up by>");
}
else
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SendInfMsg(playerid, "You are moved up");
SetPlayerPos(playerid, x, y, z + strval(upnum));
}
return 1;
}
if (strcmp(command, "/giveweapon", true) ==0)
{
new wplayer, weap, ammo;
wplayer = strval(strtok(cmdtext, index));
weap = strval(strtok(cmdtext, index));
ammo = strval(strtok(cmdtext, index));
GivePlayerWeapon(wplayer, weap, ammo);
new wname[MAX_WEAPON_NAME];
GetWeaponName(weap, wname, MAX_WEAPON_NAME);
new string[256];
format(string, sizeof(string),"Your have recieved a %s with %d ammo", wname, ammo );
SendInfMsg(wplayer, string);
return 1;
}
if (strcmp(command, "/sethealth", true) ==0)
{
new hplayer[256], health[256];
hplayer = strtok(cmdtext, index);
health = strtok(cmdtext, index);
if(!strlen(hplayer) || !strlen(health))
{
SendErrMsg(playerid, "Usage: /sethealth <ID/Name> <Health>");
}
else
{
if (strval(health) > 100)
{
SendErrMsg(playerid, "Number must be between 0 and 100!");
}
else
{
SetPlayerHealth(strval(hplayer), strval(health));
new string[256];
format(string, sizeof(string),"Your health has been changed to %d", strval(health));
SendInfMsg(strval(hplayer), string);
}
}
return 1;
}
if (strcmp(command, "/teleport", true) ==0)
{
new teleid[256];
teleid = strtok(cmdtext, index);
if(!strlen(teleid))
{
SendErrMsg(playerid, "Usage: /teleport <ID>");
}
else
{
new Float:x, Float:y, Float:z;
GetPlayerPos(strval (teleid), x, y, z);
SetPlayerPos(playerid, x, y, z + 4);
new telename[MAX_PLAYER_NAME];
GetPlayerName(strval(teleid), telename, MAX_PLAYER_NAME);
new string[256];
format(string, sizeof(string),"Your health has been teleported to %s", telename);
SendInfMsg(playerid, string);
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
new string2[256];
format(string2, sizeof(string2),"%s has teleported to you", playername);
SendInfMsg(strval(teleid), string2);
}
return 1;
}
if (strcmp(command, "/gethealth", true) ==0)
{
new gethealthid[256], Float:health;
gethealthid = strtok(cmdtext, index);
if(!strlen(gethealthid))
{
SendErrMsg(playerid, "Usage: /gethealth <ID>");
}
else
{
GetPlayerHealth(strval(gethealthid), Float:health);
SetPlayerHealth(strval(gethealthid), Float:health);
new healthname[MAX_PLAYER_NAME];
GetPlayerName(strval(gethealthid), healthname, MAX_PLAYER_NAME);
new string[256];
format(string, sizeof(string),"The health of %s is %d", healthname, Float:health);
SendInfMsg(playerid, string);
}
return 1;
}
if (strcmp(command, "/goto", true) ==0)
{
new gotonum[256];
gotonum = strtok(cmdtext, index);
if(!strlen(gotonum))
{
SendErrMsg(playerid, "Usage: /goto <ID> - Type /gotolist for locations");
}
else
{
if (strval(gotonum) == 1)
{
SetPlayerInterior(playerid, 10);
SetPlayerPos(playerid, 1886.2029,2339.5566,10.6016);
SetPlayerFacingAngle(playerid, 90);
SendInfMsg(playerid, "You are teleported");
SetCameraBehindPlayer(playerid);
}
if (strval(gotonum) == 2)
{
SetPlayerInterior(playerid, 1);
SetPlayerPos(playerid, -2158.6337,642.5574,1057.5937);
SetPlayerFacingAngle(playerid, 38);
SendInfMsg(playerid, "You are teleported");
SetCameraBehindPlayer(playerid);
}
if (strval(gotonum) == 3)
{
SetPlayerInterior(playerid, 17);
SetPlayerPos(playerid, -958.0768,1944.5648,9.0000);
SetPlayerFacingAngle(playerid, 195);
SendInfMsg(playerid, "You are teleported");
SetCameraBehindPlayer(playerid);
}
if (strval(gotonum) == 4)
{
SetPlayerInterior(playerid, 1);
SetPlayerPos(playerid, -784.2230,504.6317,1371.7421);
SetPlayerFacingAngle(playerid, 177);
SendInfMsg(playerid, "You are teleported");
SetCameraBehindPlayer(playerid);
}
if (strval(gotonum) == 5)
{
SetPlayerInterior(playerid, 12);
SetPlayerPos(playerid, 2324.4277,-1146.4155,1050.7100);
SetPlayerFacingAngle(playerid, 360);
SendInfMsg(playerid, "You are teleported");
SetCameraBehindPlayer(playerid);
}
if (strval(gotonum) == 6)
{
SetPlayerInterior(playerid, 7);
SetPlayerPos(playerid, -1395.6573,-201.3375,1051.3872);
SetPlayerFacingAngle(playerid, 260);
SendInfMsg(playerid, "You are teleported");
SetCameraBehindPlayer(playerid);
}
if (strval(gotonum) == 7)
{
SetPlayerInterior(playerid, 4);
SetPlayerPos(playerid, -1428.4804,-662.6060,1060.1972);
SetPlayerFacingAngle(playerid, 56);
SendInfMsg(playerid, "You are teleported");
SetCameraBehindPlayer(playerid);
}
if (strval(gotonum) == 8)
{
SetPlayerInterior(playerid, 14);
SetPlayerPos(playerid, -1486.8618,1642.1459,1060.6718);
SetPlayerFacingAngle(playerid, 225);
SendInfMsg(playerid, "You are teleported");
SetCameraBehindPlayer(playerid);
}
}
return 1;
}
if (strcmp(command, "/gotolist", true) ==0)
{
new gotolistnum[256];
gotolistnum = strtok(cmdtext, index);
if(!strlen(gotolistnum))
{
SendErrMsg(playerid, "Usage: /gotolist <Number>");
}
else
{
if (strval(gotolistnum) == 1)
{
SendInfMsg(playerid, "-----Gotolist 1-----");
SendInfMsg(playerid, "1. RC Battle Room");
SendInfMsg(playerid, "2. Wuzi's Place");
SendInfMsg(playerid, "3. Dam Generator Room");
SendInfMsg(playerid, "4. Saint Marco's Bistro");
SendInfMsg(playerid, "5. Admin House");
SendInfMsg(playerid, "6. Racing Stadium");
SendInfMsg(playerid, "7. Dirtbike Stadium");
SendInfMsg(playerid, "8. KickStart Stadium");
SendInfMsg(playerid, "Type /gotolist2 for list 2");
}
if (strval(gotolistnum) == 2)
{
SendInfMsg(playerid, "-----Gotolist 2-----");
SendInfMsg(playerid, "Test for list 2");
}
}
return 1;
}
if (strcmp(command, "/lock", true) ==0)
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
SetVehicleParamsForPlayer(vehicleid, playerid, 0, 1);
SendInfMsg(playerid, "Your doors are now locked");
return 1;
}
if (strcmp(command, "/unlock", true) ==0)
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
SetVehicleParamsForPlayer(vehicleid, playerid, 0, 0);
SendInfMsg(playerid, "Your doors are now unlocked");
return 1;
}
if (strcmp(command, "/remove", true) ==0)
{
new rplayer[256];
rplayer = strtok(cmdtext, index);
if(!strlen(rplayer))
{
SendErrMsg(playerid, "Usage: /remove <ID>");
}
else
{
RemovePlayerFromVehicle(strval(rplayer));
new rname[MAX_PLAYER_NAME];
GetPlayerName(strval(rplayer), rname, MAX_PLAYER_NAME);
new string[256];
format(string, sizeof(string),"%s is no longer in a vehicle", rname);
SendInfMsg(playerid, string);
}
return 1;
}
if (strcmp(command, "/skin", true) ==0)
{
new skin[256];
skin = strtok(cmdtext, index);
if(!strlen(skin))
{
SendErrMsg(playerid, "Usage: /skin <Skin ID>");
}
else
{
SetPlayerSkin(playerid, strval(skin));
new string[256];
format(string, sizeof(string),"Your skin has been changed to skin %d", strval(skin));
SendInfMsg(playerid, string);
}
return 1;
}
if (strcmp(command, "/home", true) ==0)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2040.1792,1342.6342,10.6719);
SendInfMsg(playerid, "You are home");
return 1;
}
if(strcmp(command, "/pm", true) ==0)
{
new pmid[256], pmmsg[256];
pmid = strtok(cmdtext, index);
pmmsg = strtok(cmdtext, index);
if(!strlen(pmid))
{
SendErrMsg(playerid, "Usage: /pm <ID/Name> <Message>");
}
else
{
new string[256];
format(string, sizeof(string),"PM from %s: %s",strval(pmid), strval(pmmsg));
SendPmMsg(strval(pmid), string);
new pmname[MAX_PLAYER_NAME];
GetPlayerName(strval(pmid), pmname, MAX_PLAYER_NAME);
new string2[256];
format(string2, sizeof(string2),"PM sent to %s", pmname);
SendInfMsg(playerid, string2);
}
return 1;
}
if (strcmp(command, "/inter", true) == 0)
{
new inter[256];
inter = strtok(cmdtext, index);
if(!strlen(inter))
{
SendErrMsg(playerid, "Usage: /inter <Interior ID>");
}
else
{
SetPlayerInterior(playerid, strval(inter));
new string[256];
format(string, sizeof(string), "You have changed to interior %s", strval(inter));
SendInfMsg(playerid, string);
}
return 1;
}
if (strcmp(command, "/worldtime", true) ==0)
{
new time[256];
time = strtok(cmdtext, index);
if(!strlen(time))
{
SendErrMsg(playerid, "Usage: /worldtime <Hour>");
}
if (strval(time) > 24)
{
SendErrMsg(playerid, "Time must be between 0 and 24!");
}
else
{
SetWorldTime(strval(time));
}
return 1;
}