backup command -
jiwan - 21.10.2011
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"
Re: backup command -
aRoach - 21.10.2011
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.
Re: backup command -
jiwan - 23.10.2011
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"
Re: backup command -
jiwan - 24.10.2011
help me with errors please !
Re: backup command -
jiwan - 24.10.2011
bump to page 1 !
Re: backup command -
Rks25 - 24.10.2011
This isn't a game of copy/paste. Learn how to script.;
Re: backup command -
jiwan - 24.10.2011
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
Re: backup command -
Zonoya - 24.10.2011
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
Re: backup command -
Rks25 - 24.10.2011
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);
Re: backup command -
Zonoya - 24.10.2011
well yeah ill edit it