Need some commands. (+1 rep if helped) -
sniperwars - 31.03.2012
Hi guys,
My friend suggested for the server two commands which are /tow and /goto
/teleport [playerid]
This command is for all players and I need it to send a client message to player he is teleporting to and a client message that says the player is not connected.
/tow
This command can be used with all vehicles except flying vehicles.
If anyone scripts any working commands in
STRCMP format, I will give them +1 rep.
Re: Need some commands. (+1 rep if helped) -
Randyy - 31.03.2012
PHP код:
if(strcmp(cmd, "/teleport", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /teleport [playerid]");
return 1;
}
giveplayerid = strval(tmp);
new Float:x,Float:y,Float:z;
GetPlayerPos(giveplayerid, x, y ,z);
new giveplayerint = GetPlayerInterior(giveplayerid);
new giveplayervir = GetPlayerVirtualWorld(giveplayerid);
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 101)
{
if (IsPlayerInAnyVehicle(playerid))
{
new playervec = GetPlayerVehicleID(playerid);
SetVehiclePos(playervec, x, y, z+3.5);
LinkVehicleToInterior(playervec, giveplayerint);
SetVehicleVirtualWorld(playervec, giveplayerint);
SetPlayerInterior(playerid, giveplayerint);
SetPlayerVirtualWorld(playerid, giveplayervir);
SetVehicleZAngle(playervec, z);
PutPlayerInVehicle(playerid, playervec, 0);
format(string, sizeof(string), "You have teleported to %s",PlayerName[giveplayerid]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "%s teleported to you.",PlayerName[playerid]);
SendClientMessage(giveplayerid, COLOR_GREY, string);
if(IsPlayerInHouse[giveplayerid] != INVALID_HOUSE_ID && IsPlayerInHouse[playerid] == INVALID_HOUSE_ID){IsPlayerInHouse[playerid] = IsPlayerInHouse[giveplayerid];}
else{IsPlayerInHouse[playerid] = INVALID_HOUSE_ID;}
}
else
{
SetPlayerInterior(playerid, giveplayerint);
SetPlayerVirtualWorld(playerid, giveplayervir);
SetPlayerPos(playerid, x, y, z+3.5);
format(string, sizeof(string), "You have teleported to %s",PlayerName[giveplayerid]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "%s teleported to you.",PlayerName[playerid]);
SendClientMessage(giveplayerid, COLOR_GREY, string);
if(IsPlayerInHouse[giveplayerid] != INVALID_HOUSE_ID && IsPlayerInHouse[playerid] == INVALID_HOUSE_ID){IsPlayerInHouse[playerid] = IsPlayerInHouse[giveplayerid];}
else{IsPlayerInHouse[playerid] = INVALID_HOUSE_ID;}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
}
return 1;
}
Re: Need some commands. (+1 rep if helped) -
sniperwars - 31.03.2012
Can you make the command a little simpler than that ? I just want it to teleport to other players. I don't need it to detect if the player is in a house since my server is a drift server.
Re: Need some commands. (+1 rep if helped) -
introzen - 31.03.2012
pawn Код:
if(strcmp(cmd, "/teleport", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /teleport [playerid]");
return 1;
}
giveplayerid = strval(tmp);
new Float:x,Float:y,Float:z;
GetPlayerPos(giveplayerid, x, y ,z);
SetPlayerPos(playerid, x, y, z);
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid,pName,sizeof(pName));
format(string,sizeof(string),"INFO: Teleported to %s.",pName);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
Re: Need some commands. (+1 rep if helped) -
sniperwars - 31.03.2012
Код:
(2431) : error 017: undefined symbol "cmd"
(2433) : error 017: undefined symbol "tmp"
(2433) : error 017: undefined symbol "idx"
(2434) : error 017: undefined symbol "tmp"
(2439) : error 017: undefined symbol "giveplayerid"
(2439) : error 017: undefined symbol "tmp"
(2441) : error 017: undefined symbol "giveplayerid"
(2443) : warning 219: local variable "string" shadows a variable at a preceding level
(2443) : warning 219: local variable "pName" shadows a variable at a preceding level
(2444) : error 017: undefined symbol "giveplayerid"
pawn Код:
(2431) : if(strcmp(cmd, "/teleport", true) == 0)
(2433) : tmp = strtok(cmdtext, idx);
(2434) : if(!strlen(tmp))
(2439) : giveplayerid = strval(tmp);
(2441) : GetPlayerPos(giveplayerid, x, y ,z);
(2443) : new string[128], pName[MAX_PLAYER_NAME];
(2444) : GetPlayerName(giveplayerid,pName,sizeof(pName));
Re: Need some commands. (+1 rep if helped) -
introzen - 31.03.2012
pawn Код:
new idx=0;
new giveplayerid, tmp[128];
new cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/teleport", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /teleport [playerid]");
return 1;
}
giveplayerid = strval(tmp);
new Float:x,Float:y,Float:z;
GetPlayerPos(giveplayerid, x, y ,z);
SetPlayerPos(playerid, x, y, z);
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid,pName,sizeof(pName));
format(string,sizeof(string),"INFO: Teleported to %s.",pName);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
Re: Need some commands. (+1 rep if helped) -
sniperwars - 31.03.2012
Код:
(1806) : error 033: array must be indexed (variable "-unknown-")
(2434) : error 035: argument type mismatch (argument 1)
(2436) : error 047: array sizes do not match, or destination array is too small
(2446) : warning 219: local variable "string" shadows a variable at a preceding level
(2446) : warning 219: local variable "pName" shadows a variable at a preceding level
(1806) : warning 204: symbol is assigned a value that is never used: "cmd"
pawn Код:
(1806) : new cmd = strtok(cmdtext, idx);
(2434) : if(strcmp(cmd, "/teleport", true) == 0)
(2436) : tmp = strtok(cmdtext, idx);
(2446) : new string[128], pName[MAX_PLAYER_NAME];
Re: Need some commands. (+1 rep if helped) -
Randyy - 31.03.2012
PHP код:
if(strcmp(cmd, "/teleport", true) == 0)
{
new idx, tmp[32], giveplayerid;
tmp = strtok(cmdtext, idx);
new cmd = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /teleport [playerid]");
return 1;
}
giveplayerid = strval(tmp);
new Float:x,Float:y,Float:z;
GetPlayerPos(giveplayerid, x, y ,z);
SetPlayerPos(playerid, x, y, z);
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid,pName,sizeof(pName));
format(string,sizeof(string),"INFO: Teleported to %s.",pName);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
Re: Need some commands. (+1 rep if helped) -
sniperwars - 31.03.2012
That's not working with the script. You guys are just giving me commands that give 10 - 15 errors. I am placing the command in the script right and added the things introzen told me to add and it still gives errors. It doesn't matter anyway. Thanks for the help..
Re: Need some commands. (+1 rep if helped) -
Randyy - 31.03.2012
as i said u could better use the script what i gave to you at first