24.01.2011, 22:02
(
Last edited by ricardo178; 25/01/2011 at 08:36 PM.
)
Hello guys, some guys get complaines to create simple commands like a /vr one when start scripting... So i will explain how to make a simple /vr cmd for example:
You need the basic cmd format:
Put this on public OnPlayerCommandText(playerid, cmdtext[]);
Now you will put the Function code... RepairVehicle(GetPlayerVehicleID(playerid));
Will look like this:
So, i will now explain the parts:
if(strcmp(cmdtext, "/vr", true) == 0) = Basic cmd format
{ =open the script
RepairVehicle(GetPlayerVehicleID(playerid)); = This make the cmd repair the vehicle(This is the command FUNCTION)
SendClientMessage(playerid, 0xFF4444FF, "You Repaired Your Vehicle"); = This send a message to player!
return 1; = Return the value
} = Close the script
I hope this is helpfull... If you think i need to change something only replay!
You need the basic cmd format:
Put this on public OnPlayerCommandText(playerid, cmdtext[]);
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/vr", true);
pawn Code:
{
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0xFF4444FF, "You Repaired Your Vehicle");
return 1;
}
return 0;
}
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/vr", true) == 0)
{
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0xFF4444FF, "You Repaired Your Vehicle");
return 1;
}
return 0;
}
if(strcmp(cmdtext, "/vr", true) == 0) = Basic cmd format
{ =open the script
RepairVehicle(GetPlayerVehicleID(playerid)); = This make the cmd repair the vehicle(This is the command FUNCTION)
SendClientMessage(playerid, 0xFF4444FF, "You Repaired Your Vehicle"); = This send a message to player!
return 1; = Return the value
} = Close the script
I hope this is helpfull... If you think i need to change something only replay!