CMD:goto(playerid,params[])
{
new result[32],optparam[32];
if(sscanf(params,"s[32]S()[32]",result,optparam)) return SendClientMessage(playerid,-1,"/goto [place lv or ls]");
if(strcmp(result,"lv",true) == 0)// if they player typed /goto lv
{
if(isnull(optparam))//this will be called
{
SendClientMessage(playerid,-1,"/goto lv [location]");
SendClientMessage(playerid,-1,"You can choose teleport location 1 or 2");
return 1;//stops the code from continuing.
}
switch(strval(optparam))//switch statements are much faster then if/else if statements.
{
case 1://if they type /goto lv 1
{
SetPlayerPos(playerid, 0, 0, 0);
SendClientMessage(playerid, -1, "You have teleported to LV location 1!");
}
case 2://if they type /goto lv 2
{
SetPlayerPos(playerid, 0, 0,0);
SendClientMessage(playerid, -1, "You have teleported to LV location 2!");
}
default: { SendClientMessage(playerid,-1,"Invalid location number"); }// if the number is anythign becides 1 or 2
}
}
return 1;
}
|
That is a stupid way of doing it, unnecessary shit. Why the hell is the integer made a string and then converted to an integer? Why the fuck wouldn't you just make an integer?
Plus, even if you did it this way, the size of the string is massive compared to what is needed (what is needed is 4 at maximum, you aren't going to have 999+ teleports). This isn't a tutorial btw, so please hop back over the borders and go back to your own country. |
|
I am not going to spend four hours writing a tutorial on every wich way you can do something. This was a quick and simple tutorial if you don't understand it then get the fuck out. Now fuck off back to troll land kid.
|
|
Who the fuck are you? Random insults. I am simply stating there is a much easier and better method, of which I explained above, and you go ape shit on me. And, as you said, "simple tutorial", this is more like a piece of goat shit.
|
CMD:stats(playerid, params[])
{
if(isnull(params))//this is whats called if they just type /stats
{
//show the player his own stats
}
else//else this is called
{
new playa = strval(params);
if(playa != INVALID_PLAYER_ID)//checks that the commands paramater is a valid player id.
{
if(IsPlayerConnected(playa))// checks that someone is connected with that id
{
//show playerid playas stats
}
}
}
return 1;
}