how do i make as /goto cmd??
#1

how do i make a goto cmd so if i do /goto 1 and it teles me to id 1 and also how do i make something in my gamemode that when i press '2' on my keyboard my car automaticly fixes??

please i need help
Reply
#2

Zcmd.
GOTO:
pawn Код:
CMD:goto( playerid, params[ ] )
{
    if( !IsPlayerAdmin( playerid ) )
        return 0;
    new giveplayerid;
    giveplayerid = strval( params );
    if( !strlen( params ) )
        return SendClientMessage( playerid, 0xAAAAAA, "Usage: /GOTO [ID]" );
    if( giveplayerid == INVALID_PLAYER_ID || !IsPlayerConnected( giveplayerid ) )
        return SendClientMessage( playerid, 0xAAAAAA, "Invalid ID" );
    new Float:pos[ 2 ];
    GetPlayerPos( giveplayerid, pos[ 0 ], pos[ 1 ], pos[ 2 ] );
    SetPlayerPos( playerid, pos[ 0 ], pos[ 1 ], pos[ 2 ] );
    new string[ 128 ];
    GetPlayerName( giveplayerid, string, sizeof string );
    format( string, sizeof string, "You have teleported to [%d]%s", giveplayerid, string );
    SendClientMessage( playerid, 0xAAAAAA, string );
    return 1;
}
Reply
#3

C:\Users\maxime\Desktop\cmdclan.pwn(97) : error 029: invalid expression, assumed zero
C:\Users\maxime\Desktop\cmdclan.pwn(97) : error 017: undefined symbol "cmd_goto"
C:\Users\maxime\Desktop\cmdclan.pwn(97) : error 029: invalid expression, assumed zero
C:\Users\maxime\Desktop\cmdclan.pwn(97) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

PHP код:
CMD:goto(playeridparams[])
{
    new 
ID;
    new 
Str[64];
    if(
sscanf(params"u"ID)) SendClientMessage(playeridCOLOR_GREY"USAGE: /goto [playerid]");
    else if(
IsPlayerConnected(ID) == 0SendClientMessage(playeridCOLOR_GREY"Player is not connected!");
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(IDxyz);
    
SetPlayerPos(playeridx+1y+1z);
    return 
1;

Even shorter.
Reply
#5

About the errors, just get the ZCMD include.
Here's a link: https://sampforum.blast.hk/showthread.php?tid=91354

Hope I helped.
Reply
#6

i got the same error with zcmd and sscanf
Reply
#7

i found how
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)