SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 07/12/2011, 03:19 PM   #1
eеe
Huge Clucker
 
eеe's Avatar
 
Join Date: Oct 2011
Location: pawno.exe :P New Delhi/India
Posts: 333
Reputation: 48
Smile /goto and /gethere command

Introduction
Hello people today i am gonna show you how you can create a /goto and /gethere command
What is it & what does it do?
Well the /goto command teleports a admin/player(whatever u like) to another player
and the /gethere command brings a player to a admin/player (whatever you like)
How's this scripted
Of course like always in zcmd using sscanf2
Shall we start
Of course but this time my tutorial is a little different earlier i used to explain the code afterward but now i will explain side by side..
Code of /goto
pawn Code:
CMD:goto(playerid, params[])
{
    new ID;//creates a new something idk what we call it :P but it is defined later on or used in something this 1 is used in next line
    if(sscanf(params, "u", ID)) SendClientMessage(playerid, 0xFF0000FF, "USAGE: /goto [id]");//checks if you have written something after /goto if no it sends error
    else if(!IsPlayerConnected(id) || id == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");//checks if the player you are teleporting to is connected or if it is yourself if yes then comes an error
    else//ELSE what will happen if no errors
    {
    new Float:x, Float:y, Float:z;//creates new floats
    GetPlayerPos(ID, x, y, z);//gets the player id(which we have entered after /goto position and like saves them into x,y,z defined above as floats
    SetPlayerPos(playerid, x+1, y+1, z);//sets the player position the id of that player +1 in x +1 in y and z remains same as it defines height
    }
    return 1;
}
Code for /gethere command
pawn Code:
CMD:gethere(playerid,params[])
{
    new targetid, Float:x, Float:y, Float:z;//defines floats and [U]targetid(same which we did as id above)[/U]
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR, "USAGE: /gethere [id]");//checks if there is something written after /gethere if no sends the usage error
    if(!IsPlayerConnected(id) || id == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");//checks if the player is conneted or not and also checks that we are not teleporting ourselves to our self :P if we are it sends error
    GetPlayerPos(playerid, x, y, z);//gets player pos PLAYER POS not targetid
    SetPlayerPos(targetid, x+1, y+1, z);//gets the TARGETID player to the PLAYERID x+1,y+1 and z remains same as it defines height
    return 1;
}
End
Hope you have understood my tutorial if you have any problems reply here ,if you find bugs reply here and please do the first thing thats written on my sign if you liked it
__________________
If i have ever helped you please help me back by clicking here.Thank you.
Scripting for $$$ PM me for details.
Developing websites for $$$ for all occasions PM me for details.
Volt-Host 50% OFF use discount coupon - GETBACK
eеe is offline   Reply With Quote
Old 07/12/2011, 03:31 PM   #2
seanny
High-roller
 
seanny's Avatar
 
Join Date: Oct 2010
Location: Derry City, Northern Ireland
Posts: 1,493
Reputation: 41
Default Re: /goto and /gethere command

Good, Rep+'ed.
__________________
Left the SAMP scene.
seanny is offline   Reply With Quote
Old 07/12/2011, 04:08 PM   #3
CSSI
Big Clucker
 
Join Date: Apr 2011
Posts: 102
Reputation: 4
Thumbs up Re: /goto and /gethere command

pawn Code:
if(!IsPlayerConnected(id)
Sscanf has built-in connection check so Just do
pawn Code:
if(id == INVALID_PLAYER_ID)
Nice tut Btw!
CSSI is offline   Reply With Quote
Old 07/12/2011, 06:52 PM   #4
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 742
Reputation: 25
Default Re: /goto and /gethere command

your cmd can be done with max 7 lines

i dont think this is a tutorial but for beginners. they can play c&p and ye not a tutorial
Tigerkiller is offline   Reply With Quote
Old 07/12/2011, 08:14 PM   #5
xMichaelx
Big Clucker
 
Join Date: Dec 2011
Posts: 145
Reputation: 7
Default Re: /goto and /gethere command

Um, hmmmm what to say....... When i first started pawn scripting, i learnt this command in like 5secs, not really useful i am afraid although well explained.
__________________
World Of Racing: Underground
Created Using Unity For Stunning HD Graphics and 3D Quality.
xMichaelx is offline   Reply With Quote
Old 07/12/2011, 08:44 PM   #6
mehdi-jumper
High-roller
 
mehdi-jumper's Avatar
 
Join Date: Sep 2011
Location: New-Zealand
Posts: 1,876
Reputation: 51
Default Re : /goto and /gethere command

0/10, not explain so edit your post plz, this is not a Tutoriel, it is a showroom of 2 commands^^
mehdi-jumper is offline   Reply With Quote
Old 07/12/2011, 11:36 PM   #7
xMichaelx
Big Clucker
 
Join Date: Dec 2011
Posts: 145
Reputation: 7
Default Re: /goto and /gethere command

Also you are aiming this at new scripters, who proberly don't fully now what zcmd and sscanf is, VERY BAD tut 0/10 admins remove,
__________________
World Of Racing: Underground
Created Using Unity For Stunning HD Graphics and 3D Quality.
xMichaelx is offline   Reply With Quote
Old 08/12/2011, 11:10 AM   #8
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,385
Reputation: 973
Default Re: /goto and /gethere command

Sorry but this tutorial is awful. Your grammar is bad, you don't know what you're talking about and it's biased. Just giving some constructive criticism.
MP2 is offline   Reply With Quote
Old 08/12/2011, 09:25 PM   #9
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Re: /goto and /gethere command

7/10 good job man and the dude that says 0/10, Seriously how is it 0 while he showed 2 good commands. You shouldn't let someone down by saying 0/10 because 0/10 would be a tutorial with no codes or a post that is extremely horrible.
Tanush123 is offline   Reply With Quote
Old 13/10/2012, 06:08 PM   #10
Wayn
Little Clucker
 
Wayn's Avatar
 
Join Date: Sep 2011
Posts: 37
Reputation: 11
Default Re: /goto and /gethere command

please tell me a way how to use the /goto code for admin of level2+
Wayn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with goto Command mrsamp Help Archive 6 18/08/2011 03:47 PM
/goto, /gethere problem Rafa Help Archive 4 26/07/2011 08:00 PM
I need some help with a goto command and gethere Shockey HD Help Archive 6 19/07/2011 08:29 AM
How to make a /gethere id and /goto id command? Rubennnnn Help Archive 12 02/12/2009 06:42 AM


All times are GMT. The time now is 09:33 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.