06.11.2014, 17:56
(
Last edited by ItzRbj; 07/11/2014 at 12:42 PM.
)
Hey guys , this is my 2nd Tutorial and in this tutorial we'll talk about cmds
for those who searched for cmds i bet the most 3 cmds u found alot r /heal /kill and /help , i think its useless to explain them cause they're already in alot of posts but i'll show it for those who dont know
so now we made the already known cmds , lets get to the cmds which cant be found alot when searching
let start with ......... /dive for example ? alright , first u need to include the library <ocmd> .inc file
so now you probably just coppied and pasted , without even knowing what is written , so lets explain this cmd
in this line u create a new subject called (highness) which we'll use in our cmd , u can name it anything but we name it highness as what it'll be used for
u maybe wondering what this line is , in other servers , when u type /dive without typing highness , doesnt it show USAGE:/dive [100-800] ? well that line do just like that , if(sscanf(params,"i",highness)) is when player doesnt type all cmd requirements to work
this line is trying to show the (highness) is only from 100-800 , and if a player types a number below 100 or above 800 a Client Message comes out telling him the available heights
this right here creates 3 new Float subjects which r X,Y,Z , and we're gonna know why we need them now
GetPlayerPos is used to get/detect players current position
SetPlayerPos(playerid,x,y,z+highness) this is used after u get player's current pos , then add the highness to the Float:Z , z+highness just add any height u write to the Float:Z
GivePlayerWeapon(playerid,46,1); this line gives the player a weapon depending on the Weapon ID , Parachute's ID is 46 and the 1 is 1 ammo from the weap , for example Combat Shotgun's ID is 27 and u want to add 500 ammo so u make GivePlayerWeapon(playerid,27,500);
now from only this command u can learn how to make teleporting commands , do /save [file name] inside the game then go to MyDocuments>GTA San Andreas User Files>SAMP>savedpositions and you'll find it there , dont forget to only copy the FloatX,Y,Z axis , you dont need Float:Angle in the teleporting , for example
AddPlayerClass(0,136.4344,-73.7790,1.4297,194.2452,0,0,0,0,0,0); // Saving Tutorial
only copy the 136.4344,-73.7790,1.4297 , then do SetPlayerPos(playerid,savedpos)
also u can do now a /weaps command which give u a weapon or weapons , by using GivePlayerWeapon(playerid,weaponid,weapon_ammo)
hope you enjoyed this tutorial , i'll post new tutorials that come in mind immediatly , if u have a problem , just send me a msg , i'll reply :3
for those who searched for cmds i bet the most 3 cmds u found alot r /heal /kill and /help , i think its useless to explain them cause they're already in alot of posts but i'll show it for those who dont know
pawn Code:
public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp("/heal",cmdtext,true)==0)
{
SetPlayerHealth(playerid,100.0);
SendClientMessage(playerid,COLOR_YELLOW,"Your Player has been Healed");
return 1;
}
if(strcmp("/kill",cmdtext,true)==0)
{
SetPlayerHealth(playerid,0);
SendClientMessage(playerid,COLOR_RED,"You have commited suicide");
return 1;
}
if(strcmp("/help",cmdtext,true)==0)
{
SendClientMessage(playerid,COLOR_YELLOW,"Welcome to my server");
return 1;
}
return 1;
}
let start with ......... /dive for example ? alright , first u need to include the library <ocmd> .inc file
pawn Code:
CMD:dive(playerid,params[])
{
new highness;
if(sscanf(params,"i",highness))return SendClientMessage(playerid,COLOR_GREEN,"/dive [high 100-800]");
if (highness < 100 || highness > 800) return SendClientMessage(playerid,COLOR_GREEN,"/dive [high 100-800]");//COLOR_BROWN
SendClientMessage(playerid,COLOR_AQUA,"You dive. Enjoy.");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z+highness);
GivePlayerWeapon(playerid, 46, 1);
return 1;
}
pawn Code:
new highness;
pawn Code:
if(sscanf(params,"i",highness))return SendClientMessage(playerid,COLOR_GREEN,"/dive [high 100-800]");
pawn Code:
if (highness < 100 || highness > 800) return SendClientMessage(playerid,COLOR_GREEN,"/dive [high 100-800]");//COLOR_BROWN
pawn Code:
new Float:x,Float:y,Float:z;
pawn Code:
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z+highness);
GivePlayerWeapon(playerid, 46, 1);
SetPlayerPos(playerid,x,y,z+highness) this is used after u get player's current pos , then add the highness to the Float:Z , z+highness just add any height u write to the Float:Z
GivePlayerWeapon(playerid,46,1); this line gives the player a weapon depending on the Weapon ID , Parachute's ID is 46 and the 1 is 1 ammo from the weap , for example Combat Shotgun's ID is 27 and u want to add 500 ammo so u make GivePlayerWeapon(playerid,27,500);
now from only this command u can learn how to make teleporting commands , do /save [file name] inside the game then go to MyDocuments>GTA San Andreas User Files>SAMP>savedpositions and you'll find it there , dont forget to only copy the FloatX,Y,Z axis , you dont need Float:Angle in the teleporting , for example
AddPlayerClass(0,136.4344,-73.7790,1.4297,194.2452,0,0,0,0,0,0); // Saving Tutorial
only copy the 136.4344,-73.7790,1.4297 , then do SetPlayerPos(playerid,savedpos)
also u can do now a /weaps command which give u a weapon or weapons , by using GivePlayerWeapon(playerid,weaponid,weapon_ammo)
hope you enjoyed this tutorial , i'll post new tutorials that come in mind immediatly , if u have a problem , just send me a msg , i'll reply :3