Can't view the errors on my phone, but, do you even have strtok defined?
|
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
if( !strcmp( cmdtext, "/get", cmdtext, true, 4 ) )
{
if( !IsPlayerAdmin( playerid ) )
return 0;
new Index;
tmp = strtok( cmdtext, Index );
new giveplayerid = strval( tmp );
if( !IsPlayerConnected( giveplayerid ) )
return SendClientMessage( playerid, 0xAAAAAA, "Player not connected" );
if( !strlen( tmp ) )
return SendClientMessage( playerid, 0xAAAAAA, "USAGE: /get [ID]");
new Float:x, Float:y, Float:z;
GetPlayerPos( playerid, x, y, z );
SetPlayerPos( giveplayerid, x, y, z );
new string[ 128 ];
new pName[ 24 ], aName[ 24 ];
GetPlayerName( playerid, aName, 24 );
GetPlayerName( giveplayerid, pName, 24 );
format( string, sizeof string, "You have teleported %s to your location", pName );
SendClientMessage( playerid, 0xAAAAAA, string );
format( string, sizeof string, "You have been teleported to administrator %s's position", aName );
return SendClientMessage( giveplayerid, 0xAAAAAA, string );
}
O, I failed, I didn't know you already got TMP, and forgot strcmp uses "cmdtext".
pawn Code:
|
Hey. I was playing campaign earlier (for some inspiration :P) and saw that SWAT can use ropes on the helicopter and slide down them. Just wondering if this is possible and if someone knows how to do it share it with me
|
Lol nice idea, can be made using GetPlayerPos of the plane, then SetPlayerPos(x,y,z-#) on levels, till the player uses the command to stop it
But seriously nice idea lol. |
LOL ... ok i haven't any errors/warnings but it still don't work xppp
In-game: if i type the cmd (just /get) it says: 'You have teleported Michael@Belgium to your location" "You have been teleproted to adminstrator Michael@Belgium's positions" When i type /get 0; 'You have teleported Michael@Belgium to your location" "You have been teleproted to adminstrator Michael@Belgium's positions" When i type /get 1 'You have teleported Michael@Belgium to your location" "You have been teleproted to adminstrator Michael@Belgium's positions" So when i start with /get it always says: 'You have teleported Michael@Belgium to your location" "You have been teleproted to adminstrator Michael@Belgium's positions" ;o |
if( !strcmp( cmdtext, "/get", cmdtext, true, 4 ) )
{
if( !IsPlayerAdmin( playerid ) )
return 0;
new Index;
tmp = strtok( cmdtext, Index );
new giveplayerid = strval( tmp );
if( !IsPlayerConnected( giveplayerid ) )
return SendClientMessage( playerid, 0xAAAAAA, "Player not connected" );
if( !strlen( tmp ) )
return SendClientMessage( playerid, 0xAAAAAA, "USAGE: /get [ID]");
if (giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAAAAAAA, "That player ID is not available.");
if (playerid == giveplayerid) return SendClientMessage(playerid, 0xAAAAAA, "You cannot teleport to yourself");
new Float:x, Float:y, Float:z;
GetPlayerPos( playerid, x, y, z );
SetPlayerPos( giveplayerid, x, y, z );
new string[ 128 ];
new pName[ 24 ], aName[ 24 ];
GetPlayerName( playerid, aName, 24 );
GetPlayerName( giveplayerid, pName, 24 );
format( string, sizeof string, "You have teleported %s to your location", pName );
SendClientMessage( playerid, 0xAAAAAA, string );
format( string, sizeof string, "You have been teleported to administrator %s's position", aName );
return SendClientMessage( giveplayerid, 0xAAAAAA, string );
}
pawn Code:
|
COMMAND:duotilic( playerid, params[ ] ) { if ( PlayerInfo[ playerid ][ pFaction ] == 3 ) { new id, result[ 128 ], price; if ( sscanf( params, "us[128]d", id, result, price ) ) { SendUsage( playerid, "/duotilic [ћaidėjo id/dalis vardo] [tipas] [kaina]" ); SendClientMessage( playerid, COLOR_WHITE, "GALIMI TIPAI: motociklo, vairavimo, skraidymo, valties, ginklo." ); } else if ( id == INVALID_PLAYER_ID ) SendClientMessage( playerid, COLOR_GREY, " ID nerastas !" ); else if ( !aLogged[ id ] ) SendClientMessage( playerid, COLOR_GREY, " Ћaidėjas yra neprisijungęs." ); else if ( !IsPlayerToPlayer( 5.0, playerid, id ) ) SendClientMessage( playerid, COLOR_GREY, " Ћaidėjas nėra љalia tavęs." ); else if ( price < 999 ) SendClientMessage( playerid, COLOR_GREY, " Kaina turi būti daugiau nei $999." ); else { new type; if ( !strcmp( result, "motociklo", true ) && strlen( result ) == 9 ) type = 1; else if ( !strcmp( result, "vairavimo", true ) && strlen( result ) == 9 ) type = 2; else if ( !strcmp( result, "skraidymo", true ) && strlen( result ) == 9 ) type = 3; else if ( !strcmp( result, "valties", true ) && strlen( result ) == 7 ) type = 4; else if ( !strcmp( result, "ginklo", true ) && strlen( result ) == 6 ) { if ( PlayerInfo[ playerid ][ pFRank ] < 6 ) return SendClientMessage( playerid, COLOR_GREY, " Jūsų rangas permaћas, kad galėtumėte duoti љią licenziją." ); type = 5; } else return SendClientMessage( playerid, COLOR_GREY, " Įraљėte blogą tipo pavadinimą." ); PlaceOfferForPlayer( id, LICENSE_OFFER, playerid, price, type ); new string[ 42 ]; format ( string, 41, " Licenzijos tipas: %s licenzija.", result ); SendClientMessage( id, COLOR_WHITE, string ); } } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate instruktorius." ); return true; }
CMD:paintcar( playerid, params[] )
{
if ( !IsPlayerInRangeOfPoint( playerid, 2.0, 2074.2097, -1831.4398, 13.5469 ) )
return 1;
if ( !IsPlayerInAnyVehicle( playerid ) )
return SendClientMessage( playerid, -1, "You must be in a "COL_LIGHTBLUE"vehicle{FFFFFF} to use this command." );
if ( sscanf( params, "ii", params[ 0 ], params[ 1 ] ) )
return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /paintcar <color 1> <color 2>" );
if ( params[ 0 ] < 0 || params[ 0 ] > 252 || params[ 1 ] < 0 || params[ 1 ] > 252 )
return SendClientMessage( playerid, -1, ""COL_LRED"VEHICLE{FFFFFF}: Invalid "COL_LIGHTBLUE"color ID{FFFFFF}. Valid "COL_LIGHTBLUE"color ID{FFFFFF}: "COL_GREEN"0 - 252" );
new vehicleid = GetPlayerVehicleID( playerid );
SetVehiclePos( vehicleid, 2064.2068, -1831.4756, 13.5469 );
SetVehicleZAngle( vehicleid, 89.7299 );
GivePlayerMoney( playerid, -1000 );
ChangeVehicleColor( vehicleid, params[ 0 ], params[ 1 ] );
//SendClientMessage( playerid, -1, "Your "COL_LIGHTBLUE"vehicle{FFFFFF} has been resprayed." );
return 1;
}
new PaynSprayVeh
PaynSprayVeh = GetPlayerVehicleID( playerid );
forward PayNSpray1( playerid );
public PayNSpray1( playerid )
{
SetVehiclePos( PaynSprayVeh, 2074.2097, -1831.4398, 13.5469 );
SendClientMessage( playerid, -1, "Your car has been fully resprayed" );
return 1;
}
SetTimer( "PayNSpray1", 10000, 0 );
SendClientMessage( playerid, -1, "Your car has been fully resprayed" );
stock CoolDown(playerid, name, time);
stock CoolDown(playerid, name, disable);
dcmd_cooldown(playerid, params[])
{
if(CoolDown(playerid, TestCooldown, true) return SendClientMessage(playerid, 0xFF0000FF, "You cannot use this command before the cooldown is done");
{
CoolDown(playerid, TestCoolDown, 60000);
SendClientMessage(playerid, 0xFF0000FF, "Cooldown activated");
return 1;
}
}
dcmd_stopcooldown(playerid, params[])
{
if(CoolDown(playerid, TestCoolDown, false) return SendClientMessage(playerid, 0xFF0000FF, "The 'TestCoolDown' is not activated");
{
CoolDown(playerid, TestCoolDown, false);
SendClientMessage(playerid, 0xFF0000FF, "Cooldown stopped");
return 1;
}
}
public OnPlayerSpawn(playerid) { if(playerid = "WizardCM") { SetPlayerPos(playerid,0.0,0.0,6.0) }
Hopefully this should be an easy enough script, but I want a set spawn point for people with specific names.
So, for example. Код:
public OnPlayerSpawn(playerid) { if(playerid = "WizardCM") { SetPlayerPos(playerid,0.0,0.0,6.0) } Any help is greatly appreciated! |
public OnPlayerSpawn(playerid)
{
new
name[MAX_PLAYER_NAME];
if(strcmp(name, "WizardCM", false) == 0) {
SetPlayerPos(playerid,0.0,0.0,6.0);
} else if(strcmp(name, "Nic_Cramer", false) == 0) {
SetPlayerPos(playerid,0.0,0.0,6.0);
} else {
//For all others
SetPlayerPos(playerid,0.0,0.0,6.0);
}
}
pawn Код:
|