Tous les collages #523821 Brut Modifier

Mine

public text v1 · immuable
#523821 ·publié 2007-05-30 22:20 UTC
corps du collage affiché
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);

        if (strcmp(cmd, "/bnaclub", true)==0)
        {
           SetPlayerPos(playerid,2613.7576,2848.1772,19.9922); //
        }

	    else if (strcmp(cmd, "/tp", true)==0)

	 if(!IsPlayerInAnyVehicle(playerid))
	{
		SendClientMessage(playerid, RED, "You must be in a vehicle to use this command.");
	return 1;
    }

if (playerid == giveplayerid)
 {
 SendClientMessage(playerid, RED, "You can not teleport to yourself.");
 return 1;
 }
		   new temp[256];
           temp = strtok(cmdtext, idx);

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

           giveplayerid = strval(temp);
           if (!IsPlayerConnected(giveplayerid))
           {
              SendClientMessage(playerid, RED, "Invalid player ID!");
              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);
}
	return 1;
           }


else if (strcmp(cmd, "/ctp", true)==0)

	 if(!IsPlayerInAnyVehicle(playerid))
	{
		SendClientMessage(playerid, RED, "You must be in a vehicle to use this command.");
	return 1;
    }

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

		   new temp[256];
           temp = strtok(cmdtext, idx);
           
           if (!strlen(temp) || !IsNumeric(temp))
           {
             SendClientMessage(playerid, RED, "Invalid usage, correct usage: /ctp id .");
             return 1;
           }

           giveplayerid = strval(temp);
           if (!IsPlayerConnected(giveplayerid))
           {
              SendClientMessage(playerid, RED, "Invalid player ID!");
              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);
        }
return 1;
}