Need some commands. (+1 rep if helped)
#1

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.
Reply
#2

PHP код:
    if(strcmp(cmd"/teleport"true) == 0)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playeridCOLOR_GREY"USAGE: /teleport [playerid]");
            return 
1;
        }
        
giveplayerid strval(tmp);
        new 
Float:x,Float:y,Float:z;
        
GetPlayerPos(giveplayeridx,z);
        new 
giveplayerint GetPlayerInterior(giveplayerid);
        new 
giveplayervir GetPlayerVirtualWorld(giveplayerid);
        if ((
IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 101)
        {
            if (
IsPlayerInAnyVehicle(playerid))
            {
                new 
playervec GetPlayerVehicleID(playerid);
                
SetVehiclePos(playervecxyz+3.5);
                
LinkVehicleToInterior(playervecgiveplayerint);
                
SetVehicleVirtualWorld(playervecgiveplayerint);
                
SetPlayerInterior(playeridgiveplayerint);
                
SetPlayerVirtualWorld(playeridgiveplayervir);
                
SetVehicleZAngle(playervecz);
                
PutPlayerInVehicle(playeridplayervec0);
                
format(stringsizeof(string), "You have teleported to %s",PlayerName[giveplayerid]);
                
SendClientMessage(playeridCOLOR_GREYstring);
                
format(stringsizeof(string), "%s teleported to you.",PlayerName[playerid]);
                
SendClientMessage(giveplayeridCOLOR_GREYstring);
                if(
IsPlayerInHouse[giveplayerid] != INVALID_HOUSE_ID && IsPlayerInHouse[playerid] == INVALID_HOUSE_ID){IsPlayerInHouse[playerid] = IsPlayerInHouse[giveplayerid];}
                else{
IsPlayerInHouse[playerid] = INVALID_HOUSE_ID;}
            }
            else
            {
                
SetPlayerInterior(playeridgiveplayerint);
                
SetPlayerVirtualWorld(playeridgiveplayervir);
                
SetPlayerPos(playeridxyz+3.5);
                
format(stringsizeof(string), "You have teleported to %s",PlayerName[giveplayerid]);
                
SendClientMessage(playeridCOLOR_GREYstring);
                
format(stringsizeof(string), "%s teleported to you.",PlayerName[playerid]);
                
SendClientMessage(giveplayeridCOLOR_GREYstring);
                if(
IsPlayerInHouse[giveplayerid] != INVALID_HOUSE_ID && IsPlayerInHouse[playerid] == INVALID_HOUSE_ID){IsPlayerInHouse[playerid] = IsPlayerInHouse[giveplayerid];}
                else{
IsPlayerInHouse[playerid] = INVALID_HOUSE_ID;}
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"You are not allowed to use this command.");
        }
        return 
1;
    } 
Reply
#3

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.
Reply
#4

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;
}
Reply
#5

Код:
(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));
Reply
#6

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;
}
Reply
#7

Код:
(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];
Reply
#8

PHP код:
if(strcmp(cmd"/teleport"true) == 0

        new 
idxtmp[32], giveplayerid;
        
tmp strtok(cmdtextidx); 
        new 
cmd strtok(cmdtextidx);
        if(!
strlen(tmp)) 
        { 
            
SendClientMessage(playeridCOLOR_GREY"USAGE: /teleport [playerid]"); 
            return 
1
        } 
        
giveplayerid strval(tmp); 
        new 
Float:x,Float:y,Float:z
        
GetPlayerPos(giveplayeridx,z); 
        
SetPlayerPos(playeridxyz);
        new 
string[128], pName[MAX_PLAYER_NAME];
        
GetPlayerName(giveplayerid,pName,sizeof(pName));
        
format(string,sizeof(string),"INFO: Teleported to %s.",pName);
        
SendClientMessage(playeridCOLOR_GREYstring);
        return 
1;

Reply
#9

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..
Reply
#10

as i said u could better use the script what i gave to you at first
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)