How do I add more then one teleport in a .pwn file?
#1

Hello, I'm a very new scripter and I'm enjoying it a lot. So I got a quick question, when i make a teleport how do i put them in the same FS? instead of making a separate one for each teleport. As I said, I'm still a newb at scripting. I tried this code, but when I go in game and try it only the first one works, and not the rest. Here is an example of my work so far:


Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cia", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 100.7311,1920.8513,18.2811);
return 1;
}
return 0;
}


public OnPlayerCommandText1(playerid, cmdtext[])
{
if (strcmp("/prison", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, -1189.0684,-964.0616,129.2119);
return 1;
}
return 0;
}

If you can help me fix it I'd greatly appreciate it, thank you.
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/cia", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, 100.7311,1920.8513,18.2811);
        return 1;
    }
    if (strcmp("/prison", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, -1189.0684,-964.0616,129.2119);
        return 1;
    }
    return 0;
}
Reply
#3

About to try it, thanks for the quick response. Enjoy this community already.
Reply
#4

a little tip use zcmd+sscanf!
its better as strcmp
Reply
#5

Can you link me it please? Much appreciated
Reply
#6

use the search function im online with phone ^^ use the search function on the top of the site

search for zcmd and sscanf
Reply
#7

Quote:
Originally Posted by Tigerkiller
Посмотреть сообщение
use the search function im online with phone ^^ use the search function on the top of the site

search for zcmd and sscanf
Before he goes into that shit, he's still new, so I'm sure he'd prefer the simple to understand STRCMP.
Reply
#8

To add more teleport commands just do the same thing except different command name also a different SetPlayerPosition

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/cia", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, 100.7311,1920.8513,18.2811);
        return 1;
    }
    if (strcmp("/prison", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, -1189.0684,-964.0616,129.2119);
        return 1;
    }
    if(strcmp("/TeleportAreacommanTextHere", cmdtext, true, 10) == 0)
    {
         SetPlayerPos(playerid, X, Y, Z);
         return 1;
    }
    return 0;
}
Just use the TeleportcommandTexthere and add in X,Y,Z coordinations also the Commandtext then you should be done. I would much prefer ZCMD though as it is a faster processor. If you want them in ZCMD let me know and post here
Reply
#9

when he learn it from 0 he can learn better from zcmd+sscanf
Reply
#10

Quote:
Originally Posted by Schurman
Посмотреть сообщение
Before he goes into that shit, he's still new, so I'm sure he'd prefer the simple to understand STRCMP.
Actually, he is learning the language and therefore it would be better for him to beginning with the better systems. Just because strcmp is the base-system used for making commands, it doesn't mean he should use that system.

@ rangerxxll: You should quit learning how to use strcmp for commands, take it from me. I started learning by using ZCMD and I am quite glad I did! You can use sscanf with ZCMD, allowing your commands to be much faster than standard strcmp commands!
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)