How do I add more then one teleport in a .pwn file? -
rangerxxll - 12.08.2011
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.
Re: How do I add more then one teleport in a .pwn file? -
SchurmanCQC - 12.08.2011
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;
}
Re: How do I add more then one teleport in a .pwn file? -
rangerxxll - 12.08.2011
About to try it, thanks for the quick response. Enjoy this community already.
Re: How do I add more then one teleport in a .pwn file? -
Tigerkiller - 12.08.2011
a little tip use zcmd+sscanf!
its better as strcmp
Re: How do I add more then one teleport in a .pwn file? -
rangerxxll - 12.08.2011
Can you link me it please? Much appreciated
Re: How do I add more then one teleport in a .pwn file? -
Tigerkiller - 12.08.2011
use the search function im online with phone ^^ use the search function on the top of the site
search for zcmd and sscanf
Re: How do I add more then one teleport in a .pwn file? -
SchurmanCQC - 12.08.2011
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.
Re: How do I add more then one teleport in a .pwn file? -
PhoenixB - 12.08.2011
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
Re: How do I add more then one teleport in a .pwn file? -
Tigerkiller - 12.08.2011
when he learn it from 0 he can learn better from zcmd+sscanf
Re: How do I add more then one teleport in a .pwn file? -
Scenario - 12.08.2011
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!