A Error Message Needed For this command!
#1

Hello, My name is Fadhilkab.I would like to have a Error message.Because many peoples spam/abuse this command.So once they have created a pirate ship, And when they try to create it again they should recieve a error message such as "ERROR:You Already have a ship please do /removeship then only you can create it "

Here is the code
Will Support you By REP++
Код:
CMD:pirate(playerid, params[])
{
	{
		new Float:x,Float:y,Float:z,Float:a;
		GetPlayerPos(playerid,x,y,z);
		GetPlayerFacingAngle(playerid,a);
		piratev[playerid] = CreateVehicle(484,x+3,y+3,z,a,1,1,10000);
		pirateo[playerid] = CreateObject(8493, 0.195679, 0.113892, -10.283400, 0.0, 0.0, 96.0);
		LinkVehicleToInterior(piratev[playerid], 10);
		PutPlayerInVehicle(playerid, piratev[playerid], 0);
		AttachObjectToVehicle(pirateo[playerid], piratev[playerid], 7.0, 0.0, 16.0, 0.0, 0.0, 0.0);
        SendClientMessage(playerid, COLOR_YELLOW, "To remove the piratefun do /pirateremove.!");
		return 1;
	}

}
Код:
//=====================[PIRATE REMOVE]==========================================
CMD:pirateremove(playerid, params[])
{
	RemovePlayerFromVehicle(playerid);
	DestroyObject(pirateo[playerid]);
	DestroyVehicle(piratev[playerid]);
	GameTextForPlayer(playerid, "~g~Succsessfully destroyed",10000,5);
 	return 1;
}
Thanking you
-Your's own : Fadhil
Reply
#2

Create one variable and set for the command, example:

pawn Код:
new CreateShip[MAX_PLAYERS];

//In Command:

CreateShip[playerid] = 1;

// Top of Command;

if(CreateShip[playerid] == 1) return SendClientMessage(playerid, -1, "You created the ship, please use /removeship");

// Command of Remove

CreateShip[playerid] = 0;
Try this.
Reply
#3

Quote:
Originally Posted by .FuneraL.
Посмотреть сообщение
Create one variable and set for the command, example:

pawn Код:
new CreateShip[MAX_PLAYERS];

//In Command:

CreateShip[playerid] = 1;

// Top of Command;

if(CreateShip[playerid] == 1) return SendClientMessage(playerid, -1, "You created the ship, please use /removeship");

// Command of Remove

CreateShip[playerid] = 0;
Try this.
Hi, thanks for the reply.I still have problem when i type /pirate it show's you already have pirate ship. can u fix that too?

Код:
CMD:pirate(playerid, params[])
{
    pirated[playerid] = 1;
	{
        if(pirated[playerid] == 0) return SendClientMessage(playerid, -1, "You created the ship, please use /removeship");
		new Float:x,Float:y,Float:z,Float:a;
		GetPlayerPos(playerid,x,y,z);
		GetPlayerFacingAngle(playerid,a);
		piratev[playerid] = CreateVehicle(484,x+3,y+3,z,a,1,1,10000);
		pirateo[playerid] = CreateObject(8493, 0.195679, 0.113892, -10.283400, 0.0, 0.0, 96.0);
		LinkVehicleToInterior(piratev[playerid], 10);
		PutPlayerInVehicle(playerid, piratev[playerid], 0);
		AttachObjectToVehicle(pirateo[playerid], piratev[playerid], 7.0, 0.0, 16.0, 0.0, 0.0, 0.0);
        SendClientMessage(playerid, COLOR_YELLOW, "To remove the piratefun do /pirateremove.!");
		return 1;
	}

}
Код:
//=====================[PIRATE REMOVE]==========================================
CMD:pirateremove(playerid, params[])
{
    pirated[playerid] = 0;
	RemovePlayerFromVehicle(playerid);
	DestroyObject(pirateo[playerid]);
	DestroyVehicle(piratev[playerid]);
	GameTextForPlayer(playerid, "~g~Succsessfully destroyed",10000,5);
 	return 1;
}
You helped a bit, help me to finish this last step too.
Reply
#4

pawn Код:
CMD:pirate(playerid, params[])
{
    if(pirated[playerid] == 0) return SendClientMessage(playerid, -1, "You created the ship, please use /removeship");
    new Float:x,Float:y,Float:z,Float:a;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,a);
    piratev[playerid] = CreateVehicle(484,x+3,y+3,z,a,1,1,10000);
    pirateo[playerid] = CreateObject(8493, 0.195679, 0.113892, -10.283400, 0.0, 0.0, 96.0);
    LinkVehicleToInterior(piratev[playerid], 10);
    PutPlayerInVehicle(playerid, piratev[playerid], 0);
    pirated[playerid] = 1;
    AttachObjectToVehicle(pirateo[playerid], piratev[playerid], 7.0, 0.0, 16.0, 0.0, 0.0, 0.0);
    SendClientMessage(playerid, COLOR_YELLOW, "To remove the piratefun do /pirateremove.!");
    return 1;
}
Reply
#5

Thank's Wagner Reputed And the 2nd person too For giving me a idea
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)