All pastes #526046 Raw Edit

Untitled

public text v1 · immutable
#526046 ·published 2007-05-31 17:06 UTC
rendered paste body
//==============================Commands=========================================
public OnPlayerCommandText(playerid, cmdtext[])
{
        new string[256];
        new cmd[256];
        new idx;
        new giveplayerid;
        new giveplayername[MAX_PLAYER_NAME];
        new playername[MAX_PLAYER_NAME];

	new temp[256];
        cmd = strtok(cmdtext, idx);
//=============================FightClub========================================
        if (strcmp(cmd, "/fc", true)==0)
        {
           SetPlayerPos(playerid,2613.7576,2848.1772,19.9922); //
        }
//=============================Teleport=========================================
        else if (strcmp(cmd, "/tp", true)==0)
        {
           temp = strtok(cmdtext, idx);

           if (!strlen(temp) || !IsNumeric(temp))
           {
              SendClientMessage(playerid, WHITE, "Invalid usage, Correct usage: /tp id .");
             return 1;
           }

           giveplayerid = strval(temp);
           if (!IsPlayerConnected(giveplayerid))
           {
              SendClientMessage(playerid, WHITE, "Invalid player ID!");
              return 1;
           }

           if (playerid == giveplayerid)
           {
              SendClientMessage(playerid, WHITE, "You can not teleport to yourself.");
              return 1;
           }

           new Float:x, Float:y, Float:z;
           GetPlayerPos(giveplayerid, x, y, z);
           SetPlayerPos(playerid, x, y, z);

           // Get the player names
           GetPlayerName(playerid, playername, sizeof(playername));
           GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));

           // Tell the player who they are teleporting to
           format(string, sizeof(string), "You have been teleported to %s!", giveplayername);
           SendClientMessage(playerid, YELLOW, string);

           // Tell the player who is teleporting to them
           format(string, sizeof(string), "%s has been teleported to you!", playername);
           SendClientMessage(giveplayerid, YELLOW, string);
        }
//=============================Car Teleport=====================================
        else if (strcmp(cmd, "/ctp", true)==0)
        {
	   if(!IsPlayerInAnyVehicle(playerid))
	   {
	     SendClientMessage(playerid, WHITE, "You must be in a vehicle to use this command.");
	     return 1;
           }

           temp = strtok(cmdtext, idx);

           if (!strlen(temp) || !IsNumeric(temp))
           {
             SendClientMessage(playerid, WHITE, "Invalid usage, correct usage: /ctp id .");
             return 1;
           }

           giveplayerid = strval(temp);
           if (!IsPlayerConnected(giveplayerid))
           {
              SendClientMessage(playerid, WHITE, "Invalid player ID!");
              return 1;
           }

           if (playerid == giveplayerid)
           {
              SendClientMessage(playerid, WHITE, "You can not teleport to yourself.");
              return 1;
           }

           new Float:x, Float:y, Float:z;
           GetPlayerPos(giveplayerid, x, y, z);
           SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);

           // Get the player names
           GetPlayerName(playerid, playername, sizeof(playername));
           GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));

           // Tell the player who they are teleporting to
           format(string, sizeof(string), "You have been car-teleported to %s!", giveplayername);
           SendClientMessage(playerid, YELLOW, string);

           // Tell the player who is teleporting to them
           format(string, sizeof(string), "%s has been car-teleported to you!", playername);
           SendClientMessage(giveplayerid, YELLOW, string);
        }
//=====================================Dive=====================================
    else if(strcmp(cmd, "/dive", true)==0)
        {
          if (GetPlayerMoney(playerid) > 1049)
        {
          GivePlayerMoney(playerid,-1050);
             new Float:x, Float:y, Float:z;
                 GetPlayerPos(playerid, x, y, z);
                       SetPlayerPos(playerid, x, y, z+500);
                                GivePlayerWeapon(playerid, 46, 1);
      GameTextForPlayer(playerid,"Juummmpppppp!!!", 2000, 5);
}
else{
SendClientMessage(playerid, RED,"Not enough cash.");
}
return 1;
//===================================Cardive====================================
	 if (strcmp(cmd, "/cardive", true)==0)
	 {
  if(!IsPlayerInAnyVehicle(playerid))
  {
  SendClientMessage(playerid, WHITE, "You must be in a vehicle to use this command.");
  return 1;
  }
          if (GetPlayerMoney(playerid) > 10049)
        {
          GivePlayerMoney(playerid,-10050);
	        new Float:x, Float:y, Float:z;
                GetPlayerPos(playerid, x, y, z);
                    SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z+500);
                        GivePlayerWeapon(playerid, 46, 1);
         GameTextForPlayer(playerid,"Juummmpppppp!!!", 2000, 5);
         return 1;
         }
else{
SendClientMessage(playerid, RED,"Not enough cash.");
}
return 1;
}
//======================Restart=================================================
     else if (strcmp(cmd, "/restart", true)==0)
	       {
               GameModeExit();
        return 1;
     }
//=====================/me======================================================
else if (strcmp(cmd, "/me", true)==0)
 {
 GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
  string = strtok(cmdtext, idx);

if (!strlen(string) || (cmdtext[4] == ' '))
{
 SendClientMessage(playerid, WHITE, "Usage: /me text");
 return 1;
 }
 format(string, sizeof(string), "* %s %s", playername, cmdtext[4]);
 SendClientMessageToAll(GetPlayerColor(playerid), string);

	 return 1;
}
//===================Tune 1=====================================================
	else if (strcmp(cmd, "/Tune 1", true)==0)
		   {
	        if(!IsPlayerInAnyVehicle(playerid))
	          {
	            SendClientMessage(playerid, WHITE, "You must be in a vehicle to use this command.");
             return 1;
            }
		   new Float:x, Float:y, Float:z;
		   GetPlayerPos(playerid, x, y, z);
		   SetVehiclePos(GetPlayerVehicleID(playerid),2386.5193,1038.8844,10.8203);
return 1;
}
//===================Tune 2=====================================================
	else if (strcmp(cmd, "/Tune 2", true)==0)
		   {
	        if(!IsPlayerInAnyVehicle(playerid))
	          {
	            SendClientMessage(playerid, WHITE, "You must be in a vehicle to use this command.");
             return 1;
            }
		   new Float:x, Float:y, Float:z;
		   GetPlayerPos(playerid, x, y, z);
		   SetVehiclePos(GetPlayerVehicleID(playerid),-2708.8816,217.7689,4.1797);
return 1;
}
//===================Tune 3=====================================================
	else if (strcmp(cmd, "/Tune 3", true)==0)
		   {
	        if(!IsPlayerInAnyVehicle(playerid))
	          {
	            SendClientMessage(playerid, WHITE, "You must be in a vehicle to use this command.");
             return 1;
            }
		   new Float:x, Float:y, Float:z;
		   GetPlayerPos(playerid, x, y, z);
		   SetVehiclePos(GetPlayerVehicleID(playerid),2644.4819,-2010.9142,13.5547);
return 1;
}
//===================Taxi ship==================================================
   else if (strcmp(cmd, "/taxi0", true)==0)
	 {

		SetPlayerPos(playerid, 2003.3984, 1544.7490, 13.5908);
	SendClientMessage(playerid, YELLOW, "You have been delivered to your destination safely.");
 return 1;
}
//======================Ammunation==============================================
IsPlayerInCheckpoint(playerid);
  {
	SendClientMessage(playerid, YELLOW, "Welcome to ammunation, to see the list of all weapons available to buy type /gunlist. To buy a gun type /buyammo Gunid ammo. e.g /buyammo 1 100.");
  }
   return 1;
}
//======================LEAVE THIS OR ERRORS====================================
 return 1;
}