backup command
#1

How can i create a Backup command

i just want that when a player types /backup then it sends message to all players that "player example has requested a backup" an player icon turns red on map for 2 minutes and if the player die within 2 minutes then it send message to all "you have failed to provide backup mission failed"
Reply
#2

pawn Код:
new BackupCheckpoint[ MAX_PLAYERS ];

CMD:backup( playerid )
{
    if( GetPVarInt( playerid, "BackupMission" ) == 1 ) return SendClientMessage( playerid, -1, "Backup Mission is already ON" );
    SetPVarInt( playerid, "BackupMission", 1 );
    BackupCheckpoint[ playerid ] = CreateCheckpoint( ... );
    SendClientMessage( playerid, -1, "Backup Mission was turned ON" );
    return ( 1 );
}
And at OnPlayerDeath:
pawn Код:
if( GetPVarInt( playerid, "BackupMission" ) == 1 ) return SendClientMessage( playerid, -1, "you have failed to Finish the Mission !" ), SetPVarInt( playerid, "BackupMission", 0 );
With a timer and voila.
Reply
#3

Quote:
Originally Posted by aRoach
Посмотреть сообщение
pawn Код:
new BackupCheckpoint[ MAX_PLAYERS ];

CMD:backup( playerid )
{
    if( GetPVarInt( playerid, "BackupMission" ) == 1 ) return SendClientMessage( playerid, -1, "Backup Mission is already ON" );
    SetPVarInt( playerid, "BackupMission", 1 );
    BackupCheckpoint[ playerid ] = CreateCheckpoint( ... );
    SendClientMessage( playerid, -1, "Backup Mission was turned ON" );
    return ( 1 );
}
And at OnPlayerDeath:
pawn Код:
if( GetPVarInt( playerid, "BackupMission" ) == 1 ) return SendClientMessage( playerid, -1, "you have failed to Finish the Mission !" ), SetPVarInt( playerid, "BackupMission", 0 );
With a timer and voila.
i am having 2 errors >>>>

Код:
C:\Documents and Settings\prince\Desktop\server\gamemodes\mygame.pwn(164) : error 017: undefined symbol "backup"
C:\Documents and Settings\prince\Desktop\server\gamemodes\mygame.pwn(168) : error 017: undefined symbol "CreateCheckpoint"
Reply
#4

help me with errors please !
Reply
#5

bump to page 1 !
Reply
#6

This isn't a game of copy/paste. Learn how to script.;
Reply
#7

Quote:
Originally Posted by Rks25
Посмотреть сообщение
This isn't a game of copy/paste. Learn how to script.;
i only post here after trying and messing with errors o am not a lazy man

Reply
#8

Here is one with Dcmd and the define for Dcmd goes at the top and its this
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Here is OnPlayerText
pawn Код:
public OnPlayerText(playerid, cmdtext[])
{
    dcmd(Backup, 6, cmdtext);
    return 0; // to pass on to other scripts :P
}
Now The Command NOTE dont put the command under OnPlayerCommandText put it outside of any function
pawn Код:
dcmd_Backup(playerid, params[])
{
    #pragma unused params
    if( GetPVarInt( playerid, "BackupMission" ) == 1 ) return SendClientMessage( playerid, -1, "Backup Mission is already ON" );
    SetPVarInt( playerid, "BackupMission", 1 );
    BackupCheckpoint[ playerid ] = SetPlayerCheckpoint(playerid,Float:x,Float:y,Float:z,Float:size);
    SendClientMessage( playerid, -1, "Backup Mission was turned ON" );
    return 1;
}
OnPlayerDeath
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if( GetPVarInt( playerid, "BackupMission" ) == 1 ) return SendClientMessage( playerid, -1, "you have failed to Finish the Mission !" ), SetPVarInt( playerid, "BackupMission", 0 );
    return 1;
}
as Rks25 said its not a simple copy paste situation but here is how you do it it should work fine
Reply
#9

I got a feeling, next question will be a error, leading to the line:
Код:
SetPlayerCheckpoint(....);
the complete line is:
pawn Код:
SetPlayerCheckpoint(playerid,Float:x,Float:y,Float:z,Float:size);
Reply
#10

well yeah ill edit it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)