Unknown command -
Stanford - 01.04.2013
so recently I scripted a /goto command, it compiles no warnings no errors..
Код:
if(!strcmp(cmd,"/goto",true))
{
// if player is not authorized, return error
if(!(PlayerInfo[playerid][pAdmin] & ADMIN_TELEPORT))
return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
// process command
tmp = strtok(cmdtext, idx);
// if no param entered, send help
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_FADE1,"USAGE: /goto [player] OR /goto [area]");
SendClientMessage(playerid, COLOR_FADE1,"AREAS: lsair sfair lvair lspd club newbie mafia yakuza grove ballas vagos news pier beach church");
SendClientMessage(playerid, COLOR_FADE1,"AREAS: skyscraper carrier chiliad area51 airstrip ship bayside ranch quarry dish dam bank");
SendClientMessage(playerid, COLOR_FADE1,"AREAS: nuke underwater jet battlefield 8track kickstart dirtbike bloodbowl warehouse banland");
SendClientMessage(playerid, COLOR_FADE1,"AREAS: aget, bget, cget, adrop, bdrop, cdrop");
return 1;
}
// create variables
new
p=1,
Float:a = GetPlayerFacingAngle(playerid,a),
destination[64] = " ", // container holds the name of the destination
lookupid = ReturnUser(tmp);
// if passenger or in tank leave vehicle behind
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) p=0;
// if destination is a valid playerid
if(lookupid != INVALID_PLAYER_ID)
{
// if lookupid is not playerid
if(lookupid != playerid)
{
// if lookupid isn't logged in, return error
if(!gPlayerLogged[lookupid])
return SendClientMessage(playerid, COLOR_GRAD2,"That player hasn't spawned yet.");
if(GetPlayerState(lookupid) == PLAYER_STATE_SPECTATING)
return SendClientMessage(playerid, COLOR_GRAD2,"That player is spectating someone.");
}
// create variables
new
Float:x,
Float:y,
Float:z,
i = GetPlayerInterior(lookupid),
v = GetPlayerVirtualWorld(lookupid);
// if lookupid is in a vehicle
if(IsPlayerInAnyVehicle(lookupid))
{
// get vehicle angle
GetVehicleZAngle(GetPlayerVehicleID(lookupid),a);
// else
} else {
// get facing angle
GetPlayerFacingAngle(lookupid,a);
}
// store lookupid's location
GetPlayerPos(lookupid,x,y,z);
// teleport playerid to lookupid
Teleport(playerid,x,y,z+3,a,i,v,p);
// set destination to lookupid's name
destination = Name(lookupid);
}
// else a normal destination
else if(!strcmp(tmp,"lspd",true))
{
// set destination's name
destination = "Los Santos Police Department";
// teleport player
Teleport(playerid,1529.6,-1691.2,13.3,a,0,0,p);
}
else if(!strcmp(tmp,"lsair",true))
{
destination = "Los Santos Airport";
Teleport(playerid,1934.9127,-2290.6362,13.5469,a,0,0,p);
}
else if(!strcmp(tmp,"sfair",true))
{
destination = "San Fierro Airport";
Teleport(playerid,-1417.0,-295.8,14.1,a,0,0,p);
}
else if(!strcmp(tmp,"lvair",true))
{
destination = "Las Venturas Airport";
Teleport(playerid,1699.2,1435.1, 10.7,a,0,0,p);
}
else if(!strcmp(tmp,"club",true))
{
destination = "Shootas Club";
Teleport(playerid,1822.3951,-1139.0569,24.0781,358.9008,0,0,p);
}
else if(!strcmp(tmp,"jet",true))
{
destination = "private jet";
Teleport(playerid,1.71875, 30.4062, 1200.34,a,1,0,0);
}
else if (!strcmp(tmp,"church", true))
{
destination = "the wedding chapel";
Teleport(playerid,-1948.6251,1117.9003,52.3231,88.6874,0,0,p);
}
else if (!strcmp(tmp,"carrier",true))
{
destination = "the Carrier";
Teleport(playerid,-1378.0769,509.3226,18.2344,270.9427,0,0,p);
}
else if (!strcmp(tmp,"chiliad",true))
{
destination = "Mt. Chiliad";
Teleport(playerid,-2317.5325,-1644.9664,483.7031,a,0,0,p);
}
else if (!strcmp(tmp,"area51",true))
{
destination = "Area 51";
Teleport(playerid,202.1886,1881.4122,17.2199,37.8779,0,0,p);
}
else if (!strcmp(tmp,"airstrip",true))
{
destination = "Desert Airstrip";
Teleport(playerid,357.5273,2513.8701,16.5856,a,0,0,p);
}
else if (!strcmp(tmp,"skyscraper",true) || !strcmp(tmp,"sky",true)) // shortcut 'sky'
{
destination = "the Skyscraper";
Teleport(playerid,1543.9886,-1353.7587,329.4735,a,0,0,p);
}
else if (!strcmp(tmp,"ship",true))
{
destination = "the SS Apple Day";
Teleport(playerid,-1421.4941,1489.9808,11.8084,a,0,0,p);
}
else if (!strcmp(tmp,"bayside",true))
{
destination = "Bayside Heliport";
Teleport(playerid,-2252.2944,2335.5396,4.8125,a,0,0,p);
}
else if (!strcmp(tmp,"underwater",true) || !strcmp(tmp,"under",true)) // shortcut 'under'
{
destination = "under the sea";
Teleport(playerid,-1005.3044,657.4559,-39.0847,a,0,0,p);
}
else if (!strcmp(tmp,"mafia",true))
{
destination = "Mafia Mansion";
Teleport(playerid,1279.2399,-829.3275,83.1406,321.3458,0,0,p);
}
else if (!strcmp(tmp,"yakuza",true) || !strcmp(tmp,"yak",true)) //shortcut 'yak'
{
destination = "Yakuza Teahouse";
Teleport(playerid,661.6363,-1296.6138,13.4609,323.4232,0,0,p);
}
else if (!strcmp(tmp,"ballas",true))
{
destination = "Pig Pen";
Teleport(playerid,2401.6692,-1236.7529,28.3682,333.6783,0,0,p);
}
else if (!strcmp(tmp,"vagos",true))
{
destination = "Vagos HQ";
Teleport(playerid,1702.0574,-2112.0710,13.3828,269.8425,0,0,p);
}
else if (!strcmp(tmp,"bank",true))
{
destination = "The Bank";
Teleport(playerid,1462.395751,-1016.391174,25.84375,a,0,0,p);
}
else if (!strcmp(tmp,"newbie",true))
{
destination = "the newbie spawn";
Teleport(playerid,2336.9832,-1244.5867,22.5000,317.1679,0,0,p);
}
else if (!strcmp(tmp,"news",true))
{
destination = "news hq";
Teleport(playerid,770.2726,-1355.4922,13.5313,a,0,0,p);
}
else if (!strcmp(tmp,"pier",true))
{
destination = "the fishing pier";
Teleport(playerid,364.9920,-2059.7288,15.3990,a,0,0,p);
}
else if (!strcmp(tmp,"beach",true))
{
destination = "the beach";
Teleport(playerid,527.8424,-1877.7457,3.4489,10.4223,0,0,p);
}
else if (!strcmp(tmp,"battlefield",true) || !strcmp(tmp,"battle",true)) // shortcut 'battle'
{
destination = "the battlefield";
Teleport(playerid,-972.4957,1060.9830,1345.6690,a,10,0,p);
}
else if (!strcmp(tmp,"grove",true))
{
destination = "Grove Street";
Teleport(playerid,2484.8123,-1666.4738,13.0507,a,0,0,p);
}
else if (!strcmp(tmp,"secret",true))
{
destination = "a secret place";
Teleport(playerid,964.1070,-53.2055,1001.1246,90.0000,3,0,0);
}
else if (!strcmp(tmp,"nuke",true))
{
destination = "the Nuclear Plant";
Teleport(playerid,2619.8958,2721.2993,36.7161,a,0,0,p);
}
else if (!strcmp(tmp,"dish",true))
{
destination = "the Big Ear";
Teleport(playerid,-296.0000,1558.0000,75.0000,a,0,0,p);
}
else if (!strcmp(tmp,"dam",true))
{
destination = "the Sherman Dam";
Teleport(playerid,-715.0000,2062.0000,60.0000,a,0,0,p);
}
else if (!strcmp(tmp,"ranch",true))
{
destination = "Toreno's Ranch";
Teleport(playerid,-706.4330,958.1264,12.4384,a,0,0,p);
}
else if (!strcmp(tmp,"bloodbowl",true))
{
destination = "Bloodbowl Arena";
Teleport(playerid,-1394.5928,996.4797,1033.8864,a,15,0,p);
}
else if (!strcmp(tmp,"8track",true))
{
destination = "8-Track Stadium";
Teleport(playerid,-1406.3815,-262.7644,1043.4290,346.8336,7,0,p);
}
else if (!strcmp(tmp,"dirtbike",true))
{
destination = "Dirtbike Stadium";
Teleport(playerid,-1436.2065,-642.5217,1049.5261,167.3703,4,0,p);
}
else if (!strcmp(tmp,"kickstart",true))
{
destination = "Kickstart Stadium";
Teleport(playerid,-1447.2618,1604.3374,1052.5220,263.7223,14,0,p);
}
else if (!strcmp(tmp,"quarry",true))
{
destination = "Hunter Quarry";
Teleport(playerid,609.8776,867.3369,-42.2692,a,0,0,p);
}
else if (!strcmp(tmp,"warehouse",true))
{
destination = "a warehouse";
Teleport(playerid,1391.8862,-15.8305,1000.9191,a,1,0,p);
}
else if (!strcmp(tmp,"banland",true))
{
destination = "land of the banned";
Teleport(playerid,959.0000,2142.0000,1012.0000,a,1,W_BANLAND,p);
}
else if(!strcmp(tmp,"aget",true))
{
destination = "materials a pickup";
Teleport(playerid,1410.5122,-1305.5426,9.4026,a,0,0,p);
}
else if(!strcmp(tmp,"bget",true))
{
destination = "materials b pickup";
Teleport(playerid,1514.9232,-1233.8477,16.3352,a,0,0,p);
}
else if(!strcmp(tmp,"cget",true))
{
destination = "materials c pickup";
Teleport(playerid,2605.7820,-1471.1837,16.8738,a,0,0,p);
}
else if(!strcmp(tmp,"adrop",true))
{
destination = "materials a dropoff";
Teleport(playerid,290.0343,-1502.6106,25.0424,a,0,0,p);
}
else if(!strcmp(tmp,"bdrop",true))
{
destination = "materials b dropoff";
Teleport(playerid,1684.0968,-2286.3921,-1.1248,a,0,0,p);
}
else if(!strcmp(tmp,"cdrop",true))
{
destination = "materials c dropoff";
Teleport(playerid,-90.4062,-1576.7843,2.7315,a,0,0,p);
}
else if(!strcmp(tmp,"taxi",true))
{
destination = "taxi";
Teleport(playerid,1520,-1471,10,270,0,0,p);
}
else
{
return SendClientMessage(playerid, COLOR_FADE1,"Invalid destination.");
}
// format string and send to player
format(string, sizeof(string),"Teleporting to %s",destination);
SendClientMessage(playerid, COLOR_GRAD2,string);
return 1;
}
When I come ingame it says "unknown command" can someone help me?
Re: Unknown command -
Stanford - 01.04.2013
Any help? and there are another commands that doesn't work like this..
Re: Unknown command -
Stanford - 01.04.2013
Can anyone tell me whats the problem ^^?
Re: Unknown command -
yaron0600 - 01.04.2013
Can u show here ur includes ?
Re: Unknown command -
FunnyBear - 01.04.2013
add return 1; at the end of each command inside the brackets
Re: Unknown command -
Stanford - 01.04.2013
It didn't work, I made it like this:
Код:
if(!strcmp(cmd,"/goto",true))
{
// if player is not authorized, return error
if(!(PlayerInfo[playerid][pAdmin] & ADMIN_TELEPORT))
return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
// process command
tmp = strtok(cmdtext, idx);
// if no param entered, send help
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_FADE1,"USAGE: /goto [player] OR /goto [area]");
SendClientMessage(playerid, COLOR_FADE1,"AREAS: lsair sfair lvair lspd club newbie mafia yakuza grove ballas vagos news pier beach church");
SendClientMessage(playerid, COLOR_FADE1,"AREAS: skyscraper carrier chiliad area51 airstrip ship bayside ranch quarry dish dam bank");
SendClientMessage(playerid, COLOR_FADE1,"AREAS: nuke underwater jet battlefield 8track kickstart dirtbike bloodbowl warehouse banland");
SendClientMessage(playerid, COLOR_FADE1,"AREAS: aget, bget, cget, adrop, bdrop, cdrop");
return 1;
}
// create variables
new
p=1,
Float:a = GetPlayerFacingAngle(playerid,a),
destination[64] = " ", // container holds the name of the destination
lookupid = ReturnUser(tmp);
// if passenger or in tank leave vehicle behind
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) p=0;
// if destination is a valid playerid
if(lookupid != INVALID_PLAYER_ID)
{
// if lookupid is not playerid
if(lookupid != playerid)
{
// if lookupid isn't logged in, return error
if(!gPlayerLogged[lookupid])
return SendClientMessage(playerid, COLOR_GRAD2,"That player hasn't spawned yet.");
if(GetPlayerState(lookupid) == PLAYER_STATE_SPECTATING)
return SendClientMessage(playerid, COLOR_GRAD2,"That player is spectating someone.");
}
// create variables
new
Float:x,
Float:y,
Float:z,
i = GetPlayerInterior(lookupid),
v = GetPlayerVirtualWorld(lookupid);
// if lookupid is in a vehicle
if(IsPlayerInAnyVehicle(lookupid))
{
// get vehicle angle
GetVehicleZAngle(GetPlayerVehicleID(lookupid),a);
// else
} else {
// get facing angle
GetPlayerFacingAngle(lookupid,a);
}
// store lookupid's location
GetPlayerPos(lookupid,x,y,z);
// teleport playerid to lookupid
Teleport(playerid,x,y,z+3,a,i,v,p);
// set destination to lookupid's name
destination = Name(lookupid);
}
// else a normal destination
else if(!strcmp(tmp,"lspd",true))
{
// set destination's name
destination = "Los Santos Police Department";
// teleport player
Teleport(playerid,1529.6,-1691.2,13.3,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"lsair",true))
{
destination = "Los Santos Airport";
Teleport(playerid,1934.9127,-2290.6362,13.5469,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"sfair",true))
{
destination = "San Fierro Airport";
Teleport(playerid,-1417.0,-295.8,14.1,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"lvair",true))
{
destination = "Las Venturas Airport";
Teleport(playerid,1699.2,1435.1, 10.7,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"club",true))
{
destination = "Shootas Club";
Teleport(playerid,1822.3951,-1139.0569,24.0781,358.9008,0,0,p);
return 1;
}
else if(!strcmp(tmp,"jet",true))
{
destination = "private jet";
Teleport(playerid,1.71875, 30.4062, 1200.34,a,1,0,0);
return 1;
}
else if (!strcmp(tmp,"church", true))
{
destination = "the wedding chapel";
Teleport(playerid,-1948.6251,1117.9003,52.3231,88.6874,0,0,p);
return 1;
}
else if (!strcmp(tmp,"carrier",true))
{
destination = "the Carrier";
Teleport(playerid,-1378.0769,509.3226,18.2344,270.9427,0,0,p);
return 1;
}
else if (!strcmp(tmp,"chiliad",true))
{
destination = "Mt. Chiliad";
Teleport(playerid,-2317.5325,-1644.9664,483.7031,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"area51",true))
{
destination = "Area 51";
Teleport(playerid,202.1886,1881.4122,17.2199,37.8779,0,0,p);
return 1;
}
else if (!strcmp(tmp,"airstrip",true))
{
destination = "Desert Airstrip";
Teleport(playerid,357.5273,2513.8701,16.5856,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"skyscraper",true) || !strcmp(tmp,"sky",true)) // shortcut 'sky'
{
destination = "the Skyscraper";
Teleport(playerid,1543.9886,-1353.7587,329.4735,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"ship",true))
{
destination = "the SS Apple Day";
Teleport(playerid,-1421.4941,1489.9808,11.8084,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"bayside",true))
{
destination = "Bayside Heliport";
Teleport(playerid,-2252.2944,2335.5396,4.8125,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"underwater",true) || !strcmp(tmp,"under",true)) // shortcut 'under'
{
destination = "under the sea";
Teleport(playerid,-1005.3044,657.4559,-39.0847,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"mafia",true))
{
destination = "Mafia Mansion";
Teleport(playerid,1279.2399,-829.3275,83.1406,321.3458,0,0,p);
return 1;
}
else if (!strcmp(tmp,"yakuza",true) || !strcmp(tmp,"yak",true)) //shortcut 'yak'
{
destination = "Yakuza Teahouse";
Teleport(playerid,661.6363,-1296.6138,13.4609,323.4232,0,0,p);
return 1;
}
else if (!strcmp(tmp,"ballas",true))
{
destination = "Pig Pen";
Teleport(playerid,2401.6692,-1236.7529,28.3682,333.6783,0,0,p);
return 1;
}
else if (!strcmp(tmp,"vagos",true))
{
destination = "Vagos HQ";
Teleport(playerid,1702.0574,-2112.0710,13.3828,269.8425,0,0,p);
return 1;
}
else if (!strcmp(tmp,"bank",true))
{
destination = "The Bank";
Teleport(playerid,1462.395751,-1016.391174,25.84375,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"newbie",true))
{
destination = "the newbie spawn";
Teleport(playerid,2336.9832,-1244.5867,22.5000,317.1679,0,0,p);
return 1;
}
else if (!strcmp(tmp,"news",true))
{
destination = "news hq";
Teleport(playerid,770.2726,-1355.4922,13.5313,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"pier",true))
{
destination = "the fishing pier";
Teleport(playerid,364.9920,-2059.7288,15.3990,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"beach",true))
{
destination = "the beach";
Teleport(playerid,527.8424,-1877.7457,3.4489,10.4223,0,0,p);
return 1;
}
else if (!strcmp(tmp,"battlefield",true) || !strcmp(tmp,"battle",true)) // shortcut 'battle'
{
destination = "the battlefield";
Teleport(playerid,-972.4957,1060.9830,1345.6690,a,10,0,p);
return 1;
}
else if (!strcmp(tmp,"grove",true))
{
destination = "Grove Street";
Teleport(playerid,2484.8123,-1666.4738,13.0507,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"secret",true))
{
destination = "a secret place";
Teleport(playerid,964.1070,-53.2055,1001.1246,90.0000,3,0,0);
return 1;
}
else if (!strcmp(tmp,"nuke",true))
{
destination = "the Nuclear Plant";
Teleport(playerid,2619.8958,2721.2993,36.7161,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"dish",true))
{
destination = "the Big Ear";
Teleport(playerid,-296.0000,1558.0000,75.0000,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"dam",true))
{
destination = "the Sherman Dam";
Teleport(playerid,-715.0000,2062.0000,60.0000,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"ranch",true))
{
destination = "Toreno's Ranch";
Teleport(playerid,-706.4330,958.1264,12.4384,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"bloodbowl",true))
{
destination = "Bloodbowl Arena";
Teleport(playerid,-1394.5928,996.4797,1033.8864,a,15,0,p);
return 1;
}
else if (!strcmp(tmp,"8track",true))
{
destination = "8-Track Stadium";
Teleport(playerid,-1406.3815,-262.7644,1043.4290,346.8336,7,0,p);
return 1;
}
else if (!strcmp(tmp,"dirtbike",true))
{
destination = "Dirtbike Stadium";
Teleport(playerid,-1436.2065,-642.5217,1049.5261,167.3703,4,0,p);
return 1;
}
else if (!strcmp(tmp,"kickstart",true))
{
destination = "Kickstart Stadium";
Teleport(playerid,-1447.2618,1604.3374,1052.5220,263.7223,14,0,p);
return 1;
}
else if (!strcmp(tmp,"quarry",true))
{
destination = "Hunter Quarry";
Teleport(playerid,609.8776,867.3369,-42.2692,a,0,0,p);
return 1;
}
else if (!strcmp(tmp,"warehouse",true))
{
destination = "a warehouse";
Teleport(playerid,1391.8862,-15.8305,1000.9191,a,1,0,p);
return 1;
}
else if (!strcmp(tmp,"banland",true))
{
destination = "land of the banned";
Teleport(playerid,959.0000,2142.0000,1012.0000,a,1,W_BANLAND,p);
return 1;
}
else if(!strcmp(tmp,"aget",true))
{
destination = "materials a pickup";
Teleport(playerid,1410.5122,-1305.5426,9.4026,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"bget",true))
{
destination = "materials b pickup";
Teleport(playerid,1514.9232,-1233.8477,16.3352,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"cget",true))
{
destination = "materials c pickup";
Teleport(playerid,2605.7820,-1471.1837,16.8738,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"adrop",true))
{
destination = "materials a dropoff";
Teleport(playerid,290.0343,-1502.6106,25.0424,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"bdrop",true))
{
destination = "materials b dropoff";
Teleport(playerid,1684.0968,-2286.3921,-1.1248,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"cdrop",true))
{
destination = "materials c dropoff";
Teleport(playerid,-90.4062,-1576.7843,2.7315,a,0,0,p);
return 1;
}
else if(!strcmp(tmp,"taxi",true))
{
destination = "taxi";
Teleport(playerid,1520,-1471,10,270,0,0,p);
return 1;
}
else
{
return SendClientMessage(playerid, COLOR_FADE1,"Invalid destination.");
}
// format string and send to player
format(string, sizeof(string),"Teleporting to %s",destination);
SendClientMessage(playerid, COLOR_GRAD2,string);
return 1;
}
Also, here are the includes:
Код:
#include <a_samp> // base sa:mp library
#include <F_Streamer>
#include <erpPickupStreamer>
Any help?
Re: Unknown command -
Stanford - 01.04.2013
Any help?
Re: Unknown command -
Private200 - 01.04.2013
Try to use "SetPlayerPos" instead.
Re: Unknown command -
Stanford - 03.04.2013
didn't work!