String help [URGENT] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: String help [URGENT] (
/showthread.php?tid=593425)
String help [URGENT] -
Commands - 05.11.2015
PHP код:
CMD:teleport(playerid, params[]) {
if(isnull(params)) return SendClientMessage(playerid, -1, "/teleport [Name] (Name = Bayside/Octane Springs!");
if(!strcmp(params, "Bayside", true)) {
SetPlayerPos(playerid, -2455.5942,2254.1738,4.9807);
SetPlayerFacingAngle(playerid, 0);
SetPlayerVirtualWorld(playerid, 1);
format(string, SOS, "You have been teleported to Bayside Warehouse!");
SendClientMessage(playerid, green, string);
}
else if(!strcmp(params, "Octane Springs", true)) {
SetPlayerPos(playerid, 397.8003,1157.7520,8.3481);
SetPlayerFacingAngle(playerid, 0);
SetPlayerVirtualWorld(playerid, 1);
format(string, SOS, "You have been teleported to Octane Springs!");
SendClientMessage(playerid, green, string);
}
else SendClientMessage(playerid, -1, "Not a valid teleport name! (Available Teleport names - Bayside and Octane Springs");
return 1;
}
I need SSCANF and ZCMD instead of strcmp no matter what. Please send SSCANF and ZCMD not strcmp one.
Re: String help [URGENT] -
David (Sabljak) - 05.11.2015
Its good, strcmp is using for text detection... if you want to put sscanf for "%d" you will need to type /teleport 1-2
Re: String help [URGENT] -
Commands - 06.11.2015
How can i do so ? Can you send a part of he code ?
Re: String help [URGENT] -
David (Sabljak) - 06.11.2015
Код:
if(sscanf(params, "i",teleport)) return SCM(playerid,-1,"Use: /teleport (number)");
Код:
switch(teleport)
{
case 1:
{
//teleport code for 1 put here
}
case 2:
{
//teleport code for 2 put here
}
}