Ls In Dcmd!!!
#1

Ok i made a /ls command to teleport you to ls but in the orignial way i wnat in dcmd but i this commadn i made it to teleport with car and in dcmd i want it to .here is my command:

Код:
{
 if(IsPlayerInAnyVehicle(playerid))
 {
        SetVehiclePos(GetPlayerVehicleID(playerid), 2497.0798, -1666.4255, 13.3438);
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    }
    else
    {
        SetPlayerPos(playerid, 2497.0798, -1666.4255, 13.3438);
    }
    new playername[MAX_PLAYER_NAME], string[90];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s has been teleported to Los Santos.", playername);
    SendClientMessageToAll(0xFFFF00AA, string);
 return 1;
 }
Reply
#2

pawn Код:
dcmd(ls,2,cmdtext);//in OnPlayerCommandText

dcmd_ls(playerid,params[])//Under OnPlayerCommandText
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehiclePos(GetPlayerVehicleID(playerid), 2497.0798, -1666.4255, 13.3438);
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    }
    else
    {
        SetPlayerPos(playerid, 2497.0798, -1666.4255, 13.3438);
    }
    new playername[MAX_PLAYER_NAME], string[90];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s has been teleported to Los Santos.", playername);
    SendClientMessageToAll(0xFFFF00AA, string);
    return 1;
}
Reply
#3

I have one question why in dcmd(ls,2,cmdtext)

Number 2 wath is it for?
Reply
#4

That's because 'ls' contains two characters.
The dcmd command 'helloworld' should look like this:
pawn Код:
dcmd(helloworld, 10, cmdtext);
because it contains ten characters
Reply
#5

Its 2 because the length of ls is 2
Reply
#6

Itachi, why do you answer while I already answered the question? That's kinda useless / spam (for higher post counter).
Reply
#7

oo I get it Thanks spdierWalk,Kwarde and itachi4x4
Reply
#8

It for number of words ex. dcmd(ls,2,cmdtext);
That 2 is number of words
Reply
#9

facepalm
I've answered that already, then someone else did (unneeded) and he said thanks already. Now you're saying it again? Sorry but that quite looks like spam.
Reply
#10

I have a problem with this command when i put it in pawno it gives me those errors

Код:
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(256) : warning 209: function "OnPlayerCommandText" should return a value
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(257) : warning 203: symbol is never used: "params"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(257 -- 274) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
And this is the command

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   dcmd(ls,2,cmdtext);
}
   dcmd_ls(playerid,params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehiclePos(GetPlayerVehicleID(playerid), 2497.0798, -1666.4255, 13.3438);
        LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    }
    else
    {
        SetPlayerPos(playerid, 2497.0798, -1666.4255, 13.3438);
    }
    new playername[MAX_PLAYER_NAME], string[90];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s has been teleported to Los Santos.", playername);
    SendClientMessageToAll(0xFFFF00AA, string);
    return 1;
}
	return 0;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)